jeudi 23 octobre 2014

Convert Date String Formats in Java


Vote count:

0




I am receiving Date Strings in this Format dd-MMM-yyyy I am intending to convert the Strings to format yyyy-MM-dd by trying to parse the String but I am getting an error



Unparseable date: 01-AUG-2014


I am trying to do:



SimpleDateFormat form new SimpleDateFormat ("yyyy-MM-dd");
String datefrom = "01-AUG-2014"
Date dfrom = form.parse(datefrom);//getting error here


How can I convert the String 01-AUG-2014 to 2014-08-01?



asked 1 min ago

Stanley

1,288

1 Answer



Vote count:

0




It should be yyyy-MMM-dd use MMM instead for Month name.



answered 18 secs ago

TAsk

7,212





Convert Date String Formats in Java

Aucun commentaire:

Enregistrer un commentaire