Why strtotime(1st January 1970) returns -3600 instead of 0 in PHP?

datetime, php

Solution

It's most likely due to your local time zone. What's the output of

var_dump(date_default_timezone_get());

on that machine? You can also check the difference between mktime and gmmktime

echo " mktime: ", mktime(), "\n";
echo " gmmktime: ", gmmktime(), "\n";

Problem

Am using `strtotime` to get seconds past `1 January 1970`, but am not understanding that why am getting `-3600` if the clock is set to `12.00AM` and I get `0` when the clock is set to `1 AM`, so what's with that `1 HOUR`? Is it an issue with the timezone? ``` echo 'I Expect 0 Here '.strtotime('1st January 1970').'<br />'; //This gives me -3600 echo 'I Expect 3600 Here '.strtotime('1st January 1970 01.00AM'); //This gives me 0 ``` P.S I've not set any Time Zone in my PHP file or I've not even modified my .ini file (Fresh Installed XAMPP) Update : Time-Zone : Europe/Berlin

Original source

Related problems