$year = date('Y', strtotime("2012"));
var_dump($year);//returns 2013
This is happening with an old server with php 5.2 and a new one with php 5.4
The server uses strtotime to get the year from a string like 2012-01-01
or 2012-01
or 2012
I also tried it using $dt = new DateTime('2012')
and then getTimestamp
returns "1374516720" which is "Mon, 22 Jul 2013 18:12:00 GMT"
What is causing this bug? In the documentation it says that strtotime accepts only the year
I don't know what to do...
Edit:
$year = date('Y', strtotime("2012"));
gets treated as military time, 20:12 current year