I need to covert milliseconds to GMT date (in Android app), example:
1372916493000
When I convert it by this code:
Calendar cal = Calendar.getInstance();
cal.setTimeZone(TimeZone.getTimeZone("GMT"));
cal.setTimeInMillis(millis);
Date date = cal.getTime();
the result is 07:41 07/04/2013
. The result is the same when I use just:
Date date = new Date(millis);
Unfortunately the result looks incorrect, it looks like my local time. I tried to convert the same number by this service and the result is 05:41 07/04/2013
, which I believe is correct. So I have two hours difference. Anybody has any suggestion / tips what's wrong with my conversion?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…