PHP: strtotime is returning false for a future date?

前端 未结 5 1834
南方客
南方客 2020-11-29 11:40

here are some debug expressions i put into eclipse, if you don\'t believe me:

\"strtotime(\"2110-07-16 10:07:47\")\" = (boolean) false    
\"strtotime(\"2110         


        
5条回答
  •  孤街浪徒
    2020-11-29 12:11

    If you want to work with dates that fall outside the 32-bit integer date range, then use PHP's dateTime objects

    try {
        $date = new DateTime('2110-07-16 10:07:47');
    } catch (Exception $e) {
        echo $e->getMessage();
        exit(1);
    }
    
    echo $date->format('Y-m-d');
    

提交回复
热议问题