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

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -