Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

DaysOld

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am working on the DaysOld assigment. I don't know how to convert a GDate object yyyy/mm/dd to Month, Date, Year. Is it something like this?

Could somebody give me examples what to pass and how to use the toString() and getLongFormat methods?
Thank you,
Moni
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi monika,
i hate that i cannot help you more, but that is part of the Cattle Drive. we are not supposed to post any code related to the assignments here.
you might have better luck asking this question in the Cattle Drive Forum...
however, i can tell you that my solution for that program uses BOTH GDate and JDate. you will not need to convert GDate to a string.
try looking at the javaranchcommon API again to see what the GDate and JDate classes will do for you.
hope this helps!
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm moving this to the Cattle Drive forum.
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you seen this page??
 
Monika Balogh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I have looked at this page before. Can we talk about certain methods? I still don't get it how to use those methods. It must be pretty simple.
Thanks anyway,
Moni
[This message has been edited by Monika Balogh (edited September 25, 2001).]
 
Marilyn de Queiroz
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
toString()
Instantiate a GDate object
Call toString() on the object
What you have written is correct if gDate is a GDate object.
If you call toString on a GDate object you will see a date formatted like "2000/7/24". (per the javadoc noted above)

getLongFormat()
Instantiate a GDate object
Call getLongFormat() on the object
What you have written is correct if gDate is a GDate object.
if you call getLongFormat() on a GDate object, you will see a date formatted like "September 22, 1999". (again per the javadoc).

Does this answer your question? Can you be a little more specific about what you don't understand?
 
Monika Balogh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did get it eventually.
Thanks for all your help!
moni
 
WHAT is your favorite color? Blue, no yellow, ahhhhhhh! Tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic