I get from the server is like 2017-01-24T16:16:30.690Z.
This date is in GMT time zone.
I want to convert this time into GMT+6
time zone as well as time format.
My expected result is: 24 January 2017 22:16
I get from the server is like 2017-01-24T16:16:30.690Z.
This date is in GMT time zone.
I want to convert this time into GMT+6
time zone as well as time format.
My expected result is: 24 January 2017 22:16
See above comments. If you apply those, try:
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
Date date = sdf.parse("2017-01-24T16:16:30.690Z", new ParsePosition(0));
sdf.setTimeZone(TimeZone.getTimeZone("GMT+06:00"));
sdf.applyPattern("d MMMM yyyy HH:mm");
String formatted = sdf.format(date);
Worked for me.