Adding years to a date resets to 1970-01-01

后端 未结 5 1012
悲&欢浪女
悲&欢浪女 2020-12-11 09:47
$somedate = \"1980-02-15\";
$otherdate = strtotime(\'+1 year\', strtotime($somedate));
echo date(\'Y-m-d\', $otherdate);

outputs

19         


        
5条回答
  •  伪装坚强ぢ
    2020-12-11 10:36

    For unix timestamp, the maximum representable time is 2038-01-19. At 03:14:07 UTC.

    So you can't represent/operate time that over it by using timestamp.

提交回复
热议问题