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

前端 未结 7 545
别跟我提以往
别跟我提以往 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:24

    You would typically use strtotime for that:

    echo strtotime('2011-05-05 17:29:34');
    

    From the manual:

    strtotime — Parse about any English textual datetime description into a Unix timestamp

    See valid date and time formats to be sure that the string you are passing in will be parsed correctly.

提交回复
热议问题