0
   $date1 = DateTime::createFromFormat('Y-m-d',"2038-01-20");
   $date2 = DateTime::createFromFormat('Y-m-d',"2038-01-21");

    echo      ($date1->format("U")) . " " .      ($date2->format("U")) . "<br>";
    echo (int)($date1->format("U")) . " " . (int)($date2->format("U")); 
    exit;

This code outputs this

 2147570117 2147656517
 2147483647 2147483647 /*not correct*/

while It should outputs the same result whither I used (int) cast or not, as in

 2147570117 2147656517
 2147570117 2147656517 /*correct*/

why when I used (int) cast the values changed to be 2147483647 for both dates ?!

Accountant م
  • 6,975
  • 3
  • 41
  • 61

0 Answers0