Unix-timestamp-javascript style timestamp generated by php

Source: Internet
Author: User
As we all know, php {code ...} the function can generate a 10-bit Unix timestamp, but in javascript, {code...} is used ...} the timestamp obtained by the function is 13 BITs accurate to milliseconds. So can I use php to generate a javascript-style Unix timestamp? PS: Yes... as we all know, php's

time();mktime();

The function can generate a 10-bit Unix timestamp, but in javascript

new Date().getTime()

The timestamp obtained by the function is 13 BITs accurate to milliseconds.
So can I use php to generate a javascript-style Unix timestamp?

PS: php code is required to run without any redundant output, but to simply output a 13-bit Unix timestamp.
PPS: time () * 1000 is not counted. Time () + random number is also not counted...

Reply content:

As we all know, php's

time();mktime();

The function can generate a 10-bit Unix timestamp, but in javascript

new Date().getTime()

The timestamp obtained by the function is 13 BITs accurate to milliseconds.
So can I use php to generate a javascript-style Unix timestamp?

PS: php code is required to run without any redundant output, but to simply output a 13-bit Unix timestamp.
PPS: time () * 1000 is not counted. Time () + random number is also not counted...

I am wrong. After the question is sent, the answer is found. Php provided another function to complete this task.

round(microtime(true) * 1000)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.