I have a function that converts time from my server, it works fine on android api 24, but now im testing on KitKat (Api 19) and the time conversion does not work as it should. Both devices receive the same data, but the conversion is not the same. Both devices have "Automatic date and time" set, and the time is the same in both devices.
Received String from server:
(Api 19) -> CurrentTimeStamp:2018-02-23T15:50:15.9643834Z
(Api 24) -> CurrentTimeStamp:2018-02-23T15:50:15.9373834Z
Conversion
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
try {
Date dateServer = dateFormat.parse(currentTimeStamp);
String currentDate = dateServer.toString();
} catch (ParseException e) {
e.printStackTrace();
}
This prints:
(Api 19) -> DateServer:Fri Feb 23 12:26:28 CST 2018
(Api 24) -> DateServer:Fri Feb 23 09:50:15 CST 2018 <- this time is correct
Any help or ideas here would be appreciated