Getting unix timestamp in milliseconds in PHP5 and Actionscript3

后端 未结 12 2561
被撕碎了的回忆
被撕碎了的回忆 2020-12-16 09:58

In Actionscript, the Unix timestamp in milliseconds is obtainable like this:

public static function getTimeStamp():uint
        {
            var now:Date =          


        
12条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-16 10:55

    when you need the millisecond in str format, I think you should use:

    public function get_millisecond() {
        list($milliPart, $secondPart) = explode(' ', microtime());
        $milliPart = substr($milliPart, 2, 3);
        return $secondPart . $milliPart;
    }
    

    this will fix the bug int some get millisecond example where the milli part is like : 0.056. some example convert the milli part to float, your will get 56 instead of 056. I think some one want 056.

    especially when you need the millisecond to order some data.

    hope will help. :)

提交回复
热议问题