Converting local timestamp to UTC timestamp in Java.
Posted
by fiXedd
on Stack Overflow
See other posts from Stack Overflow
or by fiXedd
Published on 2010-04-09T16:59:29Z
Indexed on
2010/04/09
17:03 UTC
Read the original article
Hit count: 571
I have a milliseconds-since-local-epoch timestamp that I'd like to convert into a milliseconds-since-UTC-epoch timestamp. From a quick glance through the docs it looks like something like this would work:
int offset = TimeZone.getDefault().getRawOffset();
long newTime = oldTime - offset;
Is there a better way to do this?
© Stack Overflow or respective owner