PHP: Add some milliseconds to a date() with strtotime()

Alberto

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

uzyn

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

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

PHP strtotime error when convert some date string to datetime value

From Dev

STRTOTIME to find current week, date for Monday and Saturday, PHP

From Dev

PHP Converting Integer to Date, reverse of strtotime

From Dev

PHP date & strtotime adding 12 minutes?

From Dev

PHP strtotime() with date() issue with year field

From Dev

PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

From Dev

String date to time in PHP - strtotime "loses hours"

From Dev

strtotime is not working proper in php for future date?

From Dev

format of date string for strtotime() function in php

From Dev

converting Mysql date to milliseconds in JSON using php

From Dev

PHP date conversion using strtotime

From Dev

Php: Change language in date/strftime/strtotime

From Dev

PHP strtotime conversion not working for some datetimes

From Dev

PHP: strtotime revered return strange date?

From Dev

PHP parse date with Timezone+Offset using strtotime()

From Dev

Using strtotime() PHP and revert back trough gmdate() is not returning same date

From Dev

Javascript Date, add milliseconds on constructor

From Dev

PHP strtotime() "noon" must go before date

From Dev

Date to milliseconds in PHP

From Dev

PHP: Add some milliseconds to a date() with strtotime()

From Dev

Formatting date using PHP strtotime

From Dev

PHP date returning blank for Year "2090" with strtotime

From Dev

Add milliseconds to date in SQL, not seconds

From Dev

PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

From Dev

strtotime is not working proper in php for future date?

From Dev

how to overwrite date to 1st of month php strtotime and date

From Dev

format of date string for strtotime() function in php

From Dev

Check a date interval with strtotime in php

From Dev

PHP date format and strtotime

Related Related

  1. 1

    PHP strtotime error when convert some date string to datetime value

  2. 2

    STRTOTIME to find current week, date for Monday and Saturday, PHP

  3. 3

    PHP Converting Integer to Date, reverse of strtotime

  4. 4

    PHP date & strtotime adding 12 minutes?

  5. 5

    PHP strtotime() with date() issue with year field

  6. 6

    PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

  7. 7

    String date to time in PHP - strtotime "loses hours"

  8. 8

    strtotime is not working proper in php for future date?

  9. 9

    format of date string for strtotime() function in php

  10. 10

    converting Mysql date to milliseconds in JSON using php

  11. 11

    PHP date conversion using strtotime

  12. 12

    Php: Change language in date/strftime/strtotime

  13. 13

    PHP strtotime conversion not working for some datetimes

  14. 14

    PHP: strtotime revered return strange date?

  15. 15

    PHP parse date with Timezone+Offset using strtotime()

  16. 16

    Using strtotime() PHP and revert back trough gmdate() is not returning same date

  17. 17

    Javascript Date, add milliseconds on constructor

  18. 18

    PHP strtotime() "noon" must go before date

  19. 19

    Date to milliseconds in PHP

  20. 20

    PHP: Add some milliseconds to a date() with strtotime()

  21. 21

    Formatting date using PHP strtotime

  22. 22

    PHP date returning blank for Year "2090" with strtotime

  23. 23

    Add milliseconds to date in SQL, not seconds

  24. 24

    PHP Countdown timer for promotion using strtotime("future date/time") - strtotime("now") = countdown?

  25. 25

    strtotime is not working proper in php for future date?

  26. 26

    how to overwrite date to 1st of month php strtotime and date

  27. 27

    format of date string for strtotime() function in php

  28. 28

    Check a date interval with strtotime in php

  29. 29

    PHP date format and strtotime

HotTag

Archive