File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Calendar problem !!

 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ranchers,

I am trying to set date as ' 30 April 2008' i.e 4/30/08 , but i am getting a date which is a month ahead ??

my code :


when i run this , i am expecting to get ' April 30, 2008' , but output is : 'May 30, 2008 '

what`s wrong here ? Any solution ,

Thanks,

Reagrdz,
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Months are indexed from 0, so April is actually 3. Try using the Calendar constants to avoid this sort of error, e.g.:
 
Sagar Rohankar
Ranch Hand
Posts: 2906
1
Java Spring Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ohhh , thanks Paul, I ll burn that in my mind !!!
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic