File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes GregorianCalendar object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "GregorianCalendar object" Watch "GregorianCalendar object" New topic

GregorianCalendar object

Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
If I have a GregorianCalendar object, and a method to get the date:

Now I want to display a String representation of the name of the month. So if I got back a "0", then I want to display 'January'. Obviously, I don't want a huge "if if if" statement. Thanks in advance!
Sainudheen Mydeen
Ranch Hand

Joined: Aug 18, 2003
Posts: 218
How about this

Mani Ram
Ranch Hand

Joined: Mar 11, 2002
Posts: 1140
I don't know whether any build-in methods / variable are available to do this, but in case if there aren't any, you can try this way.

Quaerendo Invenietis
Eric Sexton
Ranch Hand

Joined: Sep 12, 2003
Posts: 133
Yeah. That will work for me. Thanks.
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
Aside from the (in this case preferable) method of using an array as shown above, here's another way that will work, using java.text.SimpleDateFormat:

[ September 30, 2003: Message edited by: Jason Menard ]
I agree. Here's the link:
subject: GregorianCalendar object
jQuery in Action, 3rd edition