Get month name from Date

前端 未结 30 2893
情歌与酒
情歌与酒 2020-11-22 00:16

How can I generate the name of the month (e.g: Oct/October) from this date object in JavaScript?

var objDate = new Date(\"10/11/2009\");
30条回答
  •  [愿得一人]
    2020-11-22 00:47

    Another way to format date

    new Date().toLocaleString('en-us',{month:'long', year:'numeric', day:'numeric'}) //output: "May 21, 2019"
    

提交回复
热议问题