开发者

How to get timestamp value in php which is similar to getTime() in javascript

开发者 https://www.devze.com 2023-03-30 03:42 出处:网络
Following javascript code gives me output like : 1314066350368 new Date().getTime(); I would like to generate similar timestamp in PHP in order to get server\'s time开发者_如何学Gostamp.

Following javascript code gives me output like : 1314066350368

new Date().getTime();

I would like to generate similar timestamp in PHP in order to get server's time开发者_如何学Gostamp. kindly suggest me how to do it in PHP so my PHP code will generate exactly similar timestamps.

P.S. I do know about time() and microtime() functions in PHP. But i am looking forward to get similar outputs as i have mentioned above.


Try this:

<?php
echo microtime(true)*1000;
?>


Did you try int time ( void ), Returns the current time measured in the number of seconds since the Unix Epoch (January 1 1970 00:00:00 GMT).


the following php results time stamp that is similar to javascript 'new Date().getTime()'

function microtime_float()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec) * 100;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消