I have a date String like so :- Fri Oct 31 11:30:58 GMT+05:30 2014 I want to Convert it into 2014-10-31T6:00:00 which should be after adding the offset
Fri Oct 31 11:30:58 GMT+05:30 2014
2014-10-31T6:00:00
This should do the task, i guess.
public static void main(String args[]) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); format.setTimeZone(TimeZone.getTimeZone("UTC")); System.out.println(format.format(new Date())); }