• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert the String value into java.util.Date

 
kan ashok
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can i convert the String value into java.util.Date ?
I tried thru the following way :
String hai = "20/03/2004"; // mm/dd/yyyy
Date cdate = new SimpleDateFormat("mm/dd/yyyy").parse(hai);
It gives wrong Month.
 
Carlos Failde
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From the API:
A month is represented by an integer from 0 to 11; 0 is January, 1 is February, and so forth; thus 11 is December
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try look at your code!!

Witch month has the number '20'?
And the pattern for a month is MM. SimpleDateFormat
Ren´┐Ż
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic