Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GregorianCalendar object

 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 218
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about this

-----------------
Sainudheen
 
Mani Ram
Ranch Hand
Posts: 1140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Eric Sexton
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah. That will work for me. Thanks.
 
Jason Menard
Sheriff
Posts: 6450
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic