Getting unix timestamp in milliseconds in PHP5 and Actionscript3 Getting unix timestamp in milliseconds in PHP5 and Actionscript3 unix unix

Getting unix timestamp in milliseconds in PHP5 and Actionscript3


I used unsigned integer as the return type of the function. This should be Number.

public static function getTimeStamp():Number        {            var now:Date = new Date();            return now.getTime();        }

Think I got the function for getting milliseconds in PHP5 now.

function msTimeStamp() {    return round(microtime(1) * 1000);}


For actionscript3, new Date().getTime() should work.


In PHP you can simply call time() to get the time passed since January 1 1970 00:00:00 GMT in seconds. If you want milliseconds just do (time()*1000).

If you use microtime() multiply the second part with 1000 to get milliseconds. Multiply the first part with 1000 to get the milliseconds and round that. Then add the two numbers together. Voilá.


Use this:

intval(microtime(true)*1000)