0

When I try to convert very high dates, such as 2045-01-01, I get another date:

date("Ymd", strtotime("2045-02-15"));

I obtain a wrong date

19700101

but when

date("Ymd", strtotime("2017-02-15"));

I have the good date

20170215

I don't understand why? Someone just explain to me what's going on?

Wikub
  • 18
  • 5

1 Answers1

0

that's a unixtimestamp problem (=> https://de.wikipedia.org/wiki/Unixzeit#/media/File:Year_2038_problem.gif), better:

date_parse("2006-12-12 10:00:00");
date_parse_from_format ( 'Ymd' , "2017-02-15" );

or

$date = DateTime::createFromFormat('Ymd', "2017-02-15");
echo $date->format('Y-m-d');
timod
  • 585
  • 3
  • 13