Printing A MongoDB Date From PHP

前端 未结 5 449
忘了有多久
忘了有多久 2020-12-28 17:53

How in PHP do I get the regular timestamp format out of a MongoDB date?

Assume I have:

$my_date;
print_r($my_date);
         


        
5条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-28 18:25

    Use MongoDB\BSON\UTCDateTime MongoDate is deprecated

    $mongoDate = new \MongoDB\BSON\UTCDateTime(strtotime('2020-10-01 18:30:00'));
    

提交回复
热议问题