Skip to content Skip to sidebar Skip to footer

Date Format In Android

I have date string of the format 8/1/2011 04:06 am. I want it to convert it in to the date string of the format 2011-08-1T16:06:00-04:00 using DateFormat. I am using the code pr

Solution 1:

Try to replace this:

String date = (String) DateFormat.format(format, dateObj);

with this:

curFormater = new SimpleDateFormat(format);date = curFormater.format(dateObj);

Also, take into account that your example is a bit misleading:

04:06 am should not be 16:06:00-04:00 but 04:06 pm should be 16:06:00-04:00.

Post a Comment for "Date Format In Android"