I have one date format in 2014-12-18T05:39:04.523Z
I want to convert it into IST format.
I tried for this one.
SimpleDateFormat originalFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
SimpleDateFormat targetFormat = new SimpleDateFormat("E MMM dd HH:mm:ss z yyyy");
Date date;
try {
//2014-12-04T12:27:15
date = originalFormat.parse("2014-12-18T05:39:04.523Z");
System.out.println("Old Format : " + originalFormat.format(date));
System.out.println("New Format : " + targetFormat.format(date));
} catch (ParseException ex) {
System.out.println("Exception *** " +ex);
}
In output:
Old Format : 2014-12-18T05:39:04
New Format : Thu Dec 18 05:39:04 IST 2014
Here instead of z
, if I put Z
, it is showing like this..
New Format : Thu Dec 18 05:39:04 +0530 2014
But here I want to get 11:09 like this. How can I get the result I want?
Here day month date year all are perfect, but hours minutes seconds are not correct. I have to show 11 hours 09 minutes. Why? Because I am getting this date format one greenhouse Account. This belongs to US, so I want to convert into IST Format.