Possible Duplicate:
php get microtime from date string
For a specific purpose, I need to get the 13-digit timestamp for a date/time, but I couldn't find a solution for this.
Like mktime in PHP, we can get a 10-digit timestamp
echo mktime($hour, $minute, $second, $month, $day, $year);
This outputs something like 1346689283.
So what about the 13-digit timestamp? Is PHP itself capable of generating such timestamps?
You are looking for microtime()
http://php.net/microtime
If you want to create microtime from a specific date, just add 000
. Because in the end, the microtime is only 1 second.
Make milliseconds:
$milliseconds = round(microtime(true) * 1000);
echo date("Y-m-d",($milliseconds/1000));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With