zbestzeus
zbestzeus

Reputation: 2877

strtotime returning wrong time

echo date('Y-m-d h:m:s',strtotime('2008-11-03 16:00:29'))

Returns 2008-11-03 04:11:29

I've tried changing my default time zone and adding GMT,UTC,PTC behind the string and nothing will change the output. How do I get strtotime to match the input?

Upvotes: 1

Views: 2811

Answers (2)

Snowball
Snowball

Reputation: 11696

Use 'Y-m-d H:i:s' if you want 24-hour time, or add the am/pm to the end with 'Y-m-d h:i:s a'

Upvotes: 2

andyb
andyb

Reputation: 43823

You need i for minutes and H for 24-hour.

See date documentation.

m is month, which is why your time has 11 as minutes, the same as the month.

Upvotes: 1

Related Questions