Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Date parsing problem inside java

930431Apr 18 2012 — edited Apr 19 2012
Hi,

I'm passing a date string in format yyyy-MM-dd and trying to convert into a date value using below code by parsing the string. But, interestingly the output that i'm getting from dateVal is coming as - Tue Apr 17 00:00:00 GMT 2012 instead of 2012-04-17

Not able to understand why so.

String s1 = "2012-04-17";
SimpleDateFormat outFmt = new SimpleDateFormat("yyyy-MM-dd");
Date dateVal = outFmt.parse(s1);


Please help.

Regards,
prodyut
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 17 2012
Added on Apr 18 2012
24 comments
530 views