• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with the Calendar

 
Daniel Serrano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, I am using the Calendar to setup a date string to display and I obtain each part separately using the Calendar.getInstance.get() method and passing it the DAY_OF_MONTH, MONTH, YEAR variables. The problem is I am currently getting a 0 for month. What I am doing wrong ?
Thanks
Daniel Serrano
 
Lasse Koskela
author
Sheriff
Posts: 11962
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're doing nothing wrong. For some reason, Calendar uses a 0-based index for months. I.e. 0=January, 1=February, 2=March and so on.
 
Daniel Serrano
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, it would probably have taken me some time to figure that out as I was assuming there was a problem and Calendar was only returning the first digit of the month. Thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic