cls = <class 'datetime.datetime'>, data_string = 'Feb 29 04:55:03.687' format = '%b %d %H:%M:%S.%f'
E ValueError: day is out of range for month cls = <class 'datetime.datetime'>, data_string = 'Feb 29 04:55:03.687' format = '%b %d %H:%M:%S.%f'
E ValueError: day is out of range for month >>> datetime.strptime('Feb 28 04:55:03.687', '%b %d %H:%M:%S.%f')
datetime.datetime(1900, 2, 28, 4, 55, 3, 687000)
>>> datetime.strptime('Feb 28 13:37:06.942', '%b %d %H:%M:%S.%f')
datetime.datetime(1900, 2, 28, 13, 37, 6, 942000)Edit: no it's not, it's absolutely correct, leap years just aren't as simple as I thought!
> However, there is still a small error that must be accounted for. To eliminate this error, the Gregorian calendar stipulates that a year that is evenly divisible by 100 (for example, 1900) is a leap year only if it is also evenly divisible by 400.
> For this reason, the following years are not leap years:
> 1700, 1800, 1900, 2100, 2200, 2300, 2500, 2600
I had no idea!
The confusing part, to me, is that Python would consider the above string to be parsed into a date in the first place, given that it has no year.
datetime.strptime('Feb 29 13:37:06.942', '%b %d %H:%M:%S.%f')
edit: added code example. import datetime from datetime first obvi