There are various ways to alter strftime so that it handles pre-1900 dates:
- There's a recipe at ASPN that gives you a separate
strftime method that you can call with a date object: aspn_recipe.strftime(dt, fmt) if you set it up in a module yourself
- As @stephen-rumbalski said, the external mxDateTime package supports this; but that's using a totally different date object system
- As of version
1.5, the virtualtime package will patch both time.strftime and datetime.datetime.strftime to behave as in Python 3.3+. You can take advantage of this without enabling the other virtual time functions. (Disclaimer: I work on this package)
Note that Python 2.7, 3.0 and 3.1 have errors before the year 1900, Python 3.2 has errors before the year 1000. Additionally, pre-3.2 versions interpret years between 0 and 99 as between 1969 and 2068. Python versions from 3.3 onward support all positive years in datetime (and negative years in time.strftime), and time.strftime doesn't do any mapping of years between 0 and 99.
The original Python bug explains that they decided that this was a feature in Python 2.7 (presumably since it avoided lack of system strftime support for these dates), and then gradually worked on it in the Python 3 series, by reimplementing functionality.