java.util.Date
is always
in UTC. What makes you think it's in local time? I suspect the problem
is that you're displaying it via an instance of Calendar which uses the
local timezone, or possibly using Date.toString()
which also uses the local timezone.If this isn't the problem, please post some sample code.
I would, however, recommend that you use Joda Time anyway, which offers a much clearer API.
http://stackoverflow.com/questions/308683/how-can-i-get-the-current-date-and-time-in-utc-or-gmt-in-java
No comments:
Post a Comment