PHP Timestamp into DateTime

前端 未结 4 658
甜味超标
甜味超标 2021-01-31 01:04

Do you know how I can convert this to a strtotime, or a similar type of value to pass into the DateTime object?

The date I have:

Mon, 1         


        
4条回答
  •  梦如初夏
    2021-01-31 01:30

    Probably the simplest solution is just:

    DateTime::createFromFormat('U', $timeStamp);
    

    Where 'U' means Unix epoch. See docs: http://php.net/manual/en/datetime.createfromformat.php

提交回复
热议问题