'format the string into datetime - where am I going wrong?

can't understand why strptime() isn't parsing the month name string, I am sure I am comfused with something but i stared at it for long time and couldn't figure it out... My code is like this:

    monthDay = todayDate[0].split(' ')
    monthDay
Output: ['28', 'januari', '2022', '08:56', 'GMT−5']

# Handling of US/EU date formats
if len(monthDay) == 2:
    year = int(todayDate[1])
    month = monthDay[0]
    day = int(monthDay[1])
else:
    year = int(monthDay[2])
    month = monthDay[1]
    day = int(monthDay[0])

    month
    Output: 'januari'

todayDate = datetime.strptime(month,'%B')

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-52-e8fbf5b845ac> in <module>
----> 1 todayDate = datetime.strptime(month,'%B')

~\Anaconda3\envs\general\lib\_strptime.py in _strptime_datetime(cls, data_string, format)
    566     """Return a class cls instance based on the input string and the
    567     format string."""
--> 568     tt, fraction, gmtoff_fraction = _strptime(data_string, format)
    569     tzname, gmtoff = tt[-2:]
    570     args = tt[:6] + (fraction,)

~\Anaconda3\envs\general\lib\_strptime.py in _strptime(data_string, format)
    347     found = format_regex.match(data_string)
    348     if not found:
--> 349         raise ValueError("time data %r does not match format %r" %
    350                          (data_string, format))
    351     if len(data_string) != found.end():

ValueError: time data 'januari' does not match format '%B'


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source