get the day of the month javascript code example
Example 1: javascript get current day of month
new Date().getDate();//gets day of month (1-31)
Example 2: js get day month year
const d = new Date();
d.getMonth() + 1; // Month [mm] (1 - 12)
d.getDate(); // Day [dd] (1 - 31)
d.getFullYear(); // Year [yyyy]
Example 3: javascript get day of year from date
//Month -> 0= Jan, 11=Dec | myDate = 6 Dec 2019 10:45
var myDate = new Date(2019, 11, 06, 10, 45);
var dayInYear = Math.floor((myDate - new Date(myDate.getFullYear(), 0, 0)) / (1000 * 60 * 60 * 24));