Hello Tutors, I have some questions on setting the year in a datetime object via strptime. The issues is that in my date string I only have a day and a month ('11/27' for example). Now when I use datetime.strptime('11/27', ''%m/%d) I get a datetime object but the year is 1900. This makes sense as I did not provide one.
Then I saw that a datetime object has a replace function so now I could replace a 1900 by 2008 (we can assume the year is 2008). Then we can do datetime.strptime('11/27', '%m/%d').replace(year=2008) and it works but... Is there a way to set a default year when none is provide to strptime? Or is there another way to handle this? Many thanks, Sander _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor