I am trying to convert a string into a date. Specifically, a string of a year into a date.
strtotime('2017') // Gives us -> 1517372220
$year = '2017';
var_dump($year); // '2017'
$year = date("Y", strtotime($year));
var_dump($year); // '2018'
Why is the date method defaulting to the current time? I am passing an integer.
According to the documentation, I seem to implementing this method correctly?
string date ( string $format [, int $timestamp = time() ] )
The optional timestamp parameter is an integer Unix timestamp that defaults to the current local time if a timestamp is not given. In other words, it defaults to the value of time().