Does PHP have an inverse of the date() function (other than strtotime())?

前端 未结 7 640
别跟我提以往
别跟我提以往 2021-01-17 14:53

Is there a function that uses the date() format to interpret a string?

echo date(\'s-i-H d:m:Y\', 1304591364); // 34-29-17 05:05:2011

// Does t         


        
7条回答
  •  天命终不由人
    2021-01-17 15:36

    The real answer to this question the way I mean it is http://www.php.net/manual/en/datetime.createfromformat.php

        $date = date_create_from_format('j-M-Y', '15-Feb-2009');
        echo date_format($date, 'Y-m-d'); // 2009-02-15
    

提交回复
热议问题