Get month name from Date

前端 未结 30 3358
情歌与酒
情歌与酒 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:46

    This can be also done if you are using kendo.

    kendo.toString(dateobject, "MMMM");
    

    Here are list of formatters from kendo site:

    "d" Renders the day of the month, from 1 through 31.

    "dd" The day of the month, from 01 through 31.

    "ffffd" The abbreviated name of the day of the week.

    "ffffdd" The full name of the day of the week.

    "f" The tenths of a second in a date and time value.

    "ff" The hundredths of a second in a date and time value.

    "fff" The milliseconds in a date and time value.

    "M" The month, from 1 through 12.

    "MM" The month, from 01 through 12.

    "MMM" The abbreviated name of the month.

    "MMMM" The full name of the month.

    "h" The hour, using a 12-hour clock from 1 to 12.

    "hh" The hour, using a 12-hour clock from 01 to 12.

    "H" The hour, using a 24-hour clock from 1 to 23.

    "HH" The hour, using a 24-hour clock from 01 to 23.

    "m" The minute, from 0 through 59.

    "mm" The minute, from 00 through 59.

    "s" The second, from 0 through 59.

    "ss" The second, from 00 through 59.

    "tt" The AM/PM designator.

    "yy" The last two characters from the year value.

    "yyyy" The year full value.

    "zzz" The local timezone when using formats to parse UTC date strings.

提交回复
热议问题