I am developing a mobile application using oracle MAF. Oracle MAF provides its date component and if I select a date then output is like : 2015-06-16T04:35:00.000Z
for selected date Jun 16, 2015 10:05 AM
.
I am trying to convert this format to "Indian Standard Time" with .ical (ICalendar Date format) which should be like 20150613T100500
for the selected date Jun 16, 2015 10:05 AM
. I am using code below:
SimpleDateFormat isoFormat = new SimpleDateFormat("yyyyMMdd'T'HHmmss");
isoFormat.setTimeZone(TimeZone.getTimeZone("IST"));
String start_date_time = isoFormat.parse("20150616T043500000Z").toString();
But it returns date time as :
Tue Jun 16 04:35:00 GMT+5:30 2015
And should be like:
20150616T100500
You need to parse the value from
2015-06-16T04:35:00.000Z
UTC to ajava.util.Date
Which gives us a
java.util.Date
ofTue Jun 16 14:35:00 EST 2015
(for me).Then, you need to format this in IST
Which outputs
20150616T100500
Java 8 Time API
Just because it's good practice...
nb: If I didn't parse the value to
LocalDateTime
, then convert it toUTC
, I was out by an hour, but I'm open to knowing better ways