Get month from a date in JavaScript:
Bullet code(Small and accurate)
Bullet code(Small and accurate)
var date= new Date("04/15/2009"); //date in mm/dd/yyyy
var locale = "en-us";
var month = date.toLocaleString(locale, { month: "long" });
console.log(month);
//April
/* or if you want the shorter month name:
console.log(date.toLocaleString(locale, { month: "short" }));
Apr */
Output:
April
Comments
Post a Comment