0
echo date("Y/m/d", strtotime("third monday of february 2037")); //2037/02/16
echo date("Y/m/d", strtotime("third monday of february 2038")); //1970/01/01

The PHP version is 5.6.3. Thanks

hienbt88
  • 1,309
  • 1
  • 11
  • 13
  • 32-bit signed integer timestamps have a limited range - http://stackoverflow.com/questions/2012589/php-mysql-year-2038-bug-what-is-it-how-to-solve-it – Mark Baker Apr 24 '15 at 16:38
  • 1
    You're running into the [Year 2038 problem](http://en.wikipedia.org/wiki/Year_2038_problem). A possible solution for PHP is discussed [in this answer](http://stackoverflow.com/questions/12851138/how-can-i-convert-timestamp-of-year-2038-to-date-in-php). – Aaron D Apr 24 '15 at 16:39

2 Answers2

2

32-bit signed integer timestamps have a limited range

Quoting from the PHP docs

The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.)

This is why DateTime objects are a better way to handle dates and times

Mark Baker
  • 209,507
  • 32
  • 346
  • 385
1

From PHP doc,

Note:

The valid range of a timestamp is typically from Fri, 13 Dec 1901 20:45:54 UTC to Tue, 19 Jan 2038 03:14:07 UTC. (These are the dates that correspond to the minimum and maximum values for a 32-bit signed integer.)

You can try this way using DateTime class

$date = new DateTime('third monday of february 2038');
echo $date->format('Y/m/d');
A l w a y s S u n n y
  • 36,497
  • 8
  • 60
  • 103