I need to covert milliseconds to GMT date (in Android app), example:
1372916493000
When I convert it by this code:
Calendar cal
If result which looks incorrect means System.out.println(date)
then it's no surprise, because Date.toString
converts date into string representation in local timezone. To see result in GMT you can use this
SimpleDateFormat df = new SimpleDateFormat("hh:ss MM/dd/yyyy");
df.setTimeZone(TimeZone.getTimeZone("GMT"));
String result = df.format(millis);