Q:

new Date().time or new Date.getTime() returning negative number?

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?

A:

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.

