使用MongoDate在MongoDb中设置日期

I want to store this date in my document

 $dateStr = strtotime("2010-01-13 00:00:00");

My datetime in my PHP is Europe/Rome

date.timezone Europe/Rome Europe/Rome

Default timezone Europe/Rome When I Save the document with

"date" => new \MongoDate($dateStr),

My date is

"data" : ISODate("2010-01-12T23:00:00.000Z"),

MongoDB stores dates and times are in UTC and 2010-01-12T23:00:00.000Z is the correct UTC date for your local time 2010-01-13 00:00:00. You should convert the time back to your local time when querying the data.