Search code examples
pythondatetimedate

Get month name from number


How can I get the month name from the month number?

For instance, if I have 3, I want to return march

date.tm_month()

How to get the string march?


Solution

  • Calendar API

    From that you can see that calendar.month_name[3] would return March, and the array index of 0 is the empty string, so there's no need to worry about zero-indexing either.