Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PHP datetime difference in seconds missing one hour [duplicate]

Tags:

php

datediff

Possible Duplicate:
One hour difference, but only for some dates

Why:

strtotime('2012-11-01 00:00:00') - strtotime('2012-10-01 00:00:00')

is returning:

2674800

When the right value is:

2678400

is missing one hour.

like image 226
moraga86 Avatar asked Feb 02 '26 08:02

moraga86


1 Answers

Because your locale (as defined by date.timezone in php.ini) probably experienced a time change sometime in October, due to daylight savings time.

like image 139
Michael Berkowski Avatar answered Feb 03 '26 21:02

Michael Berkowski



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!