This has probably been asked a hundred times, yet I dare to ask: In express / mongoose I need to create a UTC ISO date in order to query MongoDB. This is what I am doing:
var date = new Date(req.params.date + " 00:00:00 UTC").toUTCString();
Whereas req.params.date equals this string: 2015-01-01
.
Above line creates: Mon, 12 Jan 2015 00:00:00 GMT
, in MongoDB I have:
"date" : ISODate("2014-12-08T00:00:00.000Z")
How do I get this to work?