3 ms·
As mentioned by sibling comments, it's because you're not specifying a year. If you change the day to the 28th you'll see that it defaults to the year 1900:
by ptx 3y ago
As mentioned by sibling comments, it's because you're not specifying a year. If you change the day to the 28th you'll see that it defaults to the year 1900:
>>> 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)
- OJFord 3y agoThat makes it weird though, because 1900 was a leap year? I sort of get it, but it's a slightly odd and inconsistent decision. Edit: no it's not, it's absolutely correct, leap years just aren't as simple as I thought!
- pxx 3y ago1900 was not a leap year... It's 0 mod 4, yes, but it's 0 mod 100 and not 0 mod 400
- OJFord 3y agoYep, thanks, I just wasn't aware of the latter rule at all. Time to re-read Falsehoods perhaps!
- jesprenj 3y agoIt wasn't. https://learn.microsoft.com/sl-SI/office/troubleshoot/excel/wrongly-assumes-1900-is-leap-year https://learn.microsoft.com/sl-SI/office/troubleshoot/excel/...
- OJFord 3y agoCrikey - more helpful to me is the page linked from there - https://learn.microsoft.com/sl-SI/office/troubleshoot/excel/determine-a-leap-year https://learn.microsoft.com/sl-SI/office/troubleshoot/excel/... > 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!
- ahazred8ta 3y ago"We establish that a bissextile [366th day] shall be inserted every four years (as with the present custom), except in centennial years. So the years 1700, 1800, and 1900 will not be leap years. Assuredly, the year 2000 will have an extra day in it." -- Greg XIII, 1582