{
'title' : 'Giving a talk: Advanced Date/Time handling with PHP',
'time' : {
'ts': ISODate("2018-04-19 15:27:32"), // ms since Epoch
'tz': 'Europe/London',
}
}
db.dates.aggregate( { '$project' : {
local_date: {
'$dateToString' : {
format: '%Y-%m-%d %H:%M:%S',
date: '$time.ts',
timezone: '$time.tz'
}
}
} } );
{
"_id" : ObjectId("5ad8a9148cb588e5ea33f228"),
"local_date" : "2018-04-19 16:34:57"
}