• 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:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

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
 
Look ma! I'm selling my stuff!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic