javascript - Concatenate date and time string into mongo date object -


i sending 2 fields client side date , time.

date in format of yyyy-mm-dd i.e 2016-11-08 , time in format of 05:30 pm or 09:45 am.

i want combine these 2 fields , create new field added_datetime , field going inserted inside mongodb, want in form of mongo date object can use searching date.

tried random things using moments.js unable want.

as mentioned in a similiar question can create date object

var date = new date(datestring); 

the code

var startdate = new date("1900-1-1 8:20:00 pm"); 

which original questioner supplied works in chrome , should work in node since it's same js engine. seems answer question.

you can find more on dates in mdn documentation , mongodb documentation.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -