PHP date & strtotime adding 12 minutes?

Rikard

This code:

date_default_timezone_set('Europe/Stockholm');
$time = date('H:m', strtotime('08:00:00'));
echo $time;

Echoes 08:12... why? what am I missing here?

Tried also online at http://writecodeonline.com/php/ with exact this code and got same result. I would expect a error in hours, in case I made something wrong, but 12 minutes seems very strange.

The 08:00:00 value is a example from my database, all times are stored as TIME.

Pavel Tvaladze

In date format 'm' means month, not minutes. Try to use 'i'. For example:

$time = date('H:i', strtotime('08:00:00'));

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 in seconds and minutes

From Dev

php strtotime in seconds and minutes

From Dev

PHP date format and strtotime

From Dev

adding a VARCHAR to DATE as MINUTES

From Dev

php strtotime disregarding hour, minutes, seconds

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 utcoffset and adding minutes

From Dev

adding minutes to a date (javascript) invalid date

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 Converting Integer to Date, reverse of strtotime

From Dev

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

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

Missing minutes in strtotime() / timestamp

From Dev

Adding hours, minutes and seconds to java SQL Date

From Dev

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

From Dev

PHP strtotime only converting correctly when adding days

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?

Related Related

  1. 1

    php strtotime in seconds and minutes

  2. 2

    php strtotime in seconds and minutes

  3. 3

    PHP date format and strtotime

  4. 4

    adding a VARCHAR to DATE as MINUTES

  5. 5

    php strtotime disregarding hour, minutes, seconds

  6. 6

    PHP date conversion using strtotime

  7. 7

    Formatting date using PHP strtotime

  8. 8

    Check a date interval with strtotime in php

  9. 9

    Javascript Date utcoffset and adding minutes

  10. 10

    adding minutes to a date (javascript) invalid date

  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 Converting Integer to Date, reverse of strtotime

  14. 14

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

  21. 21

    PHP date returning blank for Year "2090" with strtotime

  22. 22

    strtotime is not working proper in php for future date?

  23. 23

    format of date string for strtotime() function in php

  24. 24

    Missing minutes in strtotime() / timestamp

  25. 25

    Adding hours, minutes and seconds to java SQL Date

  26. 26

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

  27. 27

    PHP strtotime only converting correctly when adding days

  28. 28

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

  29. 29

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

HotTag

Archive