Can anyone explain the best way to format a date time string in Python where the date value is prior to the year 1900? strftime
requires dates later than 1900.<
Just for fun, I endend up with this solution.
a = datetime.datetime(1322, 10, 10)
# %Y%m%d
''.join(map(lambda x: '{:02}'.format(getattr(a, x)), ('year', 'month', 'day')))
# %Y-%m-%d
'-'.join(map(lambda x: '{:02}'.format(getattr(a, x)), ('year', 'month', 'day')))
# %Y%m%d%H%M%S
''.join(map(lambda x: '{:02}'.format(getattr(a, x)), ('year', 'month', 'day', 'hour', 'minute', 'second')))