node.js - How to convert mongodb date object in "mm/dd/yyyy" format in node -
i using jquery date picker in "mm/dd/yyyy" format , saving mongodb default date type. problem when fetch documents db date looks "2015-08-29t18:30:00.000z". want convert mm/dd/yyyy format can display in date field while editing record.
below code: before returning document, want chnage dates in "mm/dd/yyy" format.
var query = trips.findone({"_id":tripid},function (err, trip) { if (err) res.send(err); console.log(trip.tripenddate); res.json(trip); });
date.prototype.tolocaledatestring() need.
d = new date() > sun aug 30 2015 22:47:48 gmt+0300 (msk) d.tolocaledatestring('en-us') > "8/30/2015"
Comments
Post a Comment