Datetime php fatal error with negative timestamps

trying to analyze May 5, 1942

-872726549

DatTime::__construct() Failed to parse time string (-872726549) at position 7 (4): Unexpected character 

Same for all dates until 1 1 1970

December 31, 1969 has the same error

I am using xampp for windows, php 5.4

this causes an error:

 $topv=-872726549; $compared_time=new DateTime($topv); 
+4
source share
1 answer

according to the documentation, you should do it like this:

 $topv='1930-08-09'; $compared_time=new DateTime($topv); 
+1
source

All Articles