• Post Reply Bookmark Topic Watch Topic
  • New Topic

java.util.Calendar  RSS feed

 
manoj samarasinghe
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

i used Calender object to set valus ..
calendar.set(year,month,day,hour,minute,second);

i set year 2004 12 10...like that..

but after setting those values if i display them again
the year value is changed to 2005 and month to 1(january).... and
other values changed too.

what is the reason for that ?
need a help to get unchanged values form the calendar.
thanks
manoj.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the docs. Calendar uses months running from 0 to 11, not 1 to 12. So you set a month which is a full year + 1 month, so you end up at 10 January 2005 instead of 10 December 2004.
 
manoj samarasinghe
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot....

solved it....

manoj
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!