Jesús Ayala Jesús Ayala - 1 month ago 11
Javascript Question

how to set day number to a date variable in mongo

I have this variable in mongo

var f_date = new Date();


and I want to modify f_date's day to 1st day, I was thinking of something like

f_date.setDay(1);


how to do that???

Answer

The method for that is setDate:

f_date.setDate(1);
Comments