Reputation: 20131
if I trace new Date().toUTCString()
I get something like: Fri Aug 12 07:14:06 2011 UTC. perfect. If I trace new Date().getTime()
I get some long negative number which is decreasing as I continue to trace it. This is totally unexpected. Obviously my system clock is OK. What gives?
Upvotes: 10
Views: 20509
Reputation: 3335
What timezone are you in?
Are you by any chance in a time zone which is xxx seconds earlier than Greenwich?
Try setting the timezone to
timeFormat.setTimeZone(TimeZone.getTimeZone("YOUR TIME ZONE HERE"));
Upvotes: 1
Reputation: 14221
new Date().getTime()
returns time in milliseconds from January 1, 1970, universal time. It is positive number but I suppose you're using int
to store it so Flash Player converts milliseconds to negative as far as it is more than int.MAX_VALUE
. Use Number
to store the value of new Date().getTime()
and it will be positive.
Upvotes: 13