Y
Y
yazux2017-05-18 15:30:19
Python
yazux, 2017-05-18 15:30:19

How to get month in nominative case in python?

I do it like this:

import locale
locale.setlocale(locale.LC_ALL, 'ru_RU.UTF-8')

myDate = datetime.today()
myMonth = myDate.strftime('%B')

I get: "may".
Need to get: "May".
In all the examples that I could find, they do it in the same way and get "May".
Please help, do not scold too much, only the second day I write in python.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2017-05-18
@yazux

There are no cases in python. There is just the name of the month and the abbreviation (3 letters).
If you want in a case - create your array with the names of the month in all the necessary cases, and use the month number as an index.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question