| Author |
Date parsing error..???
|
Gaurav Jain
Ranch Hand
Joined: Mar 11, 2004
Posts: 108
|
|
I have a string coming in the format OCT/15/2004. I have to convert this in to a date object. I am using th following code: SimpleDateFormat sdf = new SimpleDateFormat("MMM/DD/yyyy"); value="Jul/13/2004"; sdf.parse(value)); Here value is OCT/15/2004. The date object i get is Jan/13/2004. No matter what month is passed the parsed date object always has the month as Jan. What is going wrong?
|
 |
Joe Ess
Bartender
Joined: Oct 29, 2001
Posts: 8261
|
|
Works fine for me.
|
"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
|
 |
Pavan Panduga
Ranch Hand
Joined: Jun 12, 2002
Posts: 68
|
|
Hi Gaurav, take a look at javadoc of SimpleDateFormat for defined formats. new SimpleDateFormat("MMM/DD/yyyy"); is different from new SimpleDateFormat("MMM/dd/yyyy"); hope this helps, Pavan
|
 |
Gaurav Jain
Ranch Hand
Joined: Mar 11, 2004
Posts: 108
|
|
Thanks it worked for me now. dd instead of DD did the trick
|
 |
 |
|
|
subject: Date parsing error..???
|
|
|