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: Add some milliseconds to a date() with strtotime()

From Dev

PHP strtotime error when convert some date string to datetime value

From Dev

PHP date format and strtotime

From Dev

Date to milliseconds in PHP

From Dev

PHP date conversion using strtotime

From Dev

Formatting date using PHP strtotime

From Dev

Check a date interval with strtotime in php

From Dev

Javascript Date, add milliseconds on constructor

From Dev

Add milliseconds to date in SQL, not seconds

From Dev

PHP strtotime conversion not working for some datetimes

From Dev

format of date string for strtotime() function in php

From Dev

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

From Dev

PHP date & strtotime adding 12 minutes?

From Dev

PHP Converting Integer to Date, reverse of strtotime

From Dev

PHP strtotime() "noon" must go before date

From Dev

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

From Dev

strtotime is not working proper in php for future date?

From Dev

Php: Change language in date/strftime/strtotime

From Dev

PHP: strtotime revered return strange date?

From Dev

PHP date returning blank for Year "2090" with strtotime

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

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

From Dev

converting Mysql date to milliseconds in JSON using php

From Dev

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

From Dev

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

From Dev

PHP parse date with Timezone+Offset using strtotime()

From Dev

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

From Dev

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

Related Related

  1. 1

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

  2. 2

    PHP strtotime error when convert some date string to datetime value

  3. 3

    PHP date format and strtotime

  4. 4

    Date to milliseconds in PHP

  5. 5

    PHP date conversion using strtotime

  6. 6

    Formatting date using PHP strtotime

  7. 7

    Check a date interval with strtotime in php

  8. 8

    Javascript Date, add milliseconds on constructor

  9. 9

    Add milliseconds to date in SQL, not seconds

  10. 10

    PHP strtotime conversion not working for some datetimes

  11. 11

    format of date string for strtotime() function in php

  12. 12

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

  13. 13

    PHP date & strtotime adding 12 minutes?

  14. 14

    PHP Converting Integer to Date, reverse of strtotime

  15. 15

    PHP strtotime() "noon" must go before date

  16. 16

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

  17. 17

    strtotime is not working proper in php for future date?

  18. 18

    Php: Change language in date/strftime/strtotime

  19. 19

    PHP: strtotime revered return strange date?

  20. 20

    PHP date returning blank for Year "2090" with strtotime

  21. 21

    strtotime is not working proper in php for future date?

  22. 22

    format of date string for strtotime() function in php

  23. 23

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

  24. 24

    converting Mysql date to milliseconds in JSON using php

  25. 25

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

  26. 26

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

  27. 27

    PHP parse date with Timezone+Offset using strtotime()

  28. 28

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

  29. 29

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

HotTag

Archive