I\'m having issues when converting a date to string in a different format. The date:
lastDownloadDate>>Wed Feb 27 16:20:23 IST 2013
lastChangeDate>&
You have used wrong format for month.
yyyy-mm-dd HH:mm:ss ----> yyyy-MM-dd HH:mm:ss
mm--->Minutes.
MM--->Months
Try
DateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Change
DateFormat outputFormat = new SimpleDateFormat("yyyy-mm-dd HH:mm:ss");
to
DateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
yyyy-mm-dd HH:mm:ss
this is wrong. This should be yyyy-MM-dd HH:mm:ss
.
Refer this http://docs.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html for more details regarding converting date from one format to another.
DateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
mm for Minutes
MM for Months