No, the Date
is not returning a different results. Date
is just a wrapper around your time in millis, nothing more. It doesn't really understand time zones, hours, etc.
However! Date.toString()
prints date using gregorian calendar with your current time zone. But even though the time zone is different, it still represents the same point in time.
Say I have this simple program:
new Date(1352296028515L).toString()
Normally it prints (I live in CET time zone):
Wed Nov 07 14:47:08 CET 2012
But I can override the time zone (-Duser.timezone=EST
) or run the program in New York to get e.g.:
Wed Nov 07 08:47:08 EST 2012
However! Note that both dates actually represents the same hour, 13:47 UTC.
Simply put: calm down, everything is fine, it's just yet another reason to stay away from java.util.Date
.