Question

I need to add just 500ms to a specific date. To add, for example, 1 day to a date, I know I can write this:

$tomorrow = date("d-m-Y",strtotime("+1 day"));

To add 500 milliseconds to a date, instead, I tried with

strotime("+500 milliseconds",date(... 

but it's not working, date becomes 00-00 etc., or sometimes it remains the same.

Thanks for any help, Alberto

Was it helpful?

Solution

If you would like to work with milliseconds, you can check out microtime().

To advance the current time by 500 milliseconds ahead, you can use:

microtime(true) + 0.5
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top