Eren Süleymanoğlu Eren Süleymanoğlu - 2 months ago 5
Python Question

(Django) how to get month name?

I have a query like below:

today =
month = today.month
print month

and it outputs:


I want to display the month name like "March". What should I do?


use the datetime string formatting method, e.g.

>>> today.strftime('%B')

for more info, and a full list of formatting codes, see the python datetime docs