Datetime

Dear all,

I continue to get the following error message

>>> parsed_date = datetime.strptime('Jan 15, 2018',' %b %d, %Y')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 568, in _strptime_datetime
    tt, fraction, gmtoff_fraction = _strptime(data_string, format)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/_strptime.py", line 349, in _strptime
    raise ValueError("time data %r does not match format %r" %
ValueError: time data 'Jan 15, 2018' does not match format ' %b %d, %Y'

Any idea how I can edit my datetime function?

It’s rather strict when it comes to the characters so a space character that is specified would then then be expected, ' %b %d, %Y' is different to '%b %d, %Y'.

2 Likes

thank you so much. That worked

2 Likes

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.