On Tue, Jan 27, 2009 at 01:01, Sander Sweers <sander.swe...@gmail.com> wrote:
> 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).

I could also do do datetime.strptime('11/27' + '/09', '%m/%d/%y').

Which solution would be recommended to use?

Thanks
Sander
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to