Hello guys I 'm storing date in mongodb. The problem that I'm facing is that the date time string that I get. I try to convert it into mongodate but it converts it to 0.00000000 2016
. Here is the code
$params['start'] = new MongoDate($params['start']);
$params['end'] = new MongoDate($params['end']);
The string bring the date time in this form 2016-04-07 19:49:50
but after the conversion it becomes like this 0.00000000 2016
. Please tell me what is it that I'm doing wrong
Per the docs, MongoDate expects a timestamp value like 1460058590
, not a string like 2016-04-07 19:49:50
.
$params['start'] = new MongoDate(strtotime($params['start']));