Creating a datetime object in Python by only providing the month preserves the month information:
>>> import datetime
>>> datetime.datetime.strptime('Feb', '%b')
datetime.datetime(1900, 2, 1, 0, 0)
>>> datetime.datetime.strptime('Feb', '%b').strftime('%B')
'February'
Since no year or day is provided, Python uses the defaults 1900 and 01, respectively, resulting in datetime.datetime(1900, 2, 1, 0, 0).
However, if a day of the week is provided:
>>> datetime.datetime.strptime('Tue', '%a')
datetime.datetime(1900, 1, 1, 0, 0)
>>> datetime.datetime.strptime('Tue', '%a').strftime('%A')
'Monday'
I understand that 1900-01-01 was Monday, but why isn't Python creating an object datetime.datetime(1900, 1, 2, 0, 0) which was the first Tuesday after 1900-01-01, similar to what it does with February in the first example?
It seems like the initial information (i.e. that the day was Tuesday) is lost without any warning or error. Is there a fundamental difference between creating a datetime object by only providing the month and only providing the day of the week?