get full month javascript date code example
Example 1: javascript month name
let date = new Date(2020, 05, 21);
let longMonth = date.toLocaleString('en-us', { month: 'long' });
let shortMonth = date.toLocaleString('en-us', { month: 'short' });
let narrowMonth = date.toLocaleString('en-us', { month: 'narrow' });
Example 2: javascript get current day of month
new Date().getDate();
Example 3: 3 letter months javascript array
var months = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
var today = new Date();
var d = today.getDate();
var m = months[today.getMonth()];
var y = months.getFullYear();
console.log(d + "-" + m + "-" + y);
Example 4: get current month of year in number javascript
var today = new Date();
var month = today.getMonth();
console.log(month);