Create an ISO date object in javascript Create an ISO date object in javascript node.js node.js

Create an ISO date object in javascript


try below:

var temp_datetime_obj = new Date();collection.find({    start_date:{        $gte: new Date(temp_datetime_obj.toISOString())    }}).toArray(function(err, items) {     /* you can console.log here */ });


In node, the Mongo driver will give you an ISO string, not the object. (ex: Mon Nov 24 2014 01:30:34 GMT-0800 (PST)) So, simply convert it to a js Date by: new Date(ISOString);