wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes GregorianCalendar issues - how to display? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GregorianCalendar issues - how to display?" Watch "GregorianCalendar issues - how to display?" New topic

GregorianCalendar issues - how to display?

James Brooks
Ranch Hand

Joined: Aug 17, 2006
Posts: 165
Hi again!

Now I'm having trouble with displaying the GregorianCalendar dates. Code is below, but what is happening is that my GregorianCalendar objects are always displaying 2/1/5 as the date, no matter what values I instantiate them with or set them with via the mutator method. Can someone tell/show me the correct way to display such an object? Thanks!

Hello. My name is Inigo Montoya. You killed my father. Prepare to die.
pete stein

Joined: Feb 23, 2007
Posts: 1561
A java convention is that all-CAPS are constants or enumerations. What you think may be class properties (YEAR, MONTH,) is actually a constant that holds the field number for the get routine. If you call myDate.get(Calender.YEAR); you'll get the year. Same call with MONTH will give you the month. Check out Class Calender at javadocs. GregorianCalender derives from the Calender superclass, so all this applies to it.

Good luck!
James Brooks
Ranch Hand

Joined: Aug 17, 2006
Posts: 165
Thanks for the help Pete, that 'cout << object.dataField' convention from C++ is still in my mind, I guess.

I agree. Here's the link: http://aspose.com/file-tools
subject: GregorianCalendar issues - how to display?
Similar Threads
Calendar UI with Multiple selection
Error - ; expected
Missing return statement
null pointer exception error
Validate Integer Length