How do I get the day of the month in javascript?
Use date_object
.getDate()
to get the month day.
From the MDN docs link:
"Returns the day of the month for the specified date according to local time."
Try getDate() instead. Confusing naming, but that's life...
var date = new Date().getDate();
From Mozilla Developer Network:
Date.prototype.getDate() The getDate() method returns the day of the month for the specified date according to local time.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getDate
const date = new Date();
const day = date.getDate();
const month = date.getMonth() + 1;
const year = date.getFullYear();