Convert formatted date back to unix

前端 未结 1 1193
南旧
南旧 2021-01-29 10:05

Which function would I use to convert custom formatted dates back to Unix Epoch time?

For example:

(\"Ymd\") -> (\"U\");

I looked a

1条回答
  •  一整个雨季
    2021-01-29 10:46

    You can use DateTime::createFromFormat():

    $date = DateTime::createFromFormat('Ymd', '20140525');
    echo $date->format('U');
    

    0 讨论(0)
提交回复
热议问题