[Python-Dev] dateutil (original) (raw)

Tim Peters tim.one at comcast.net
Thu Mar 11 15:23:16 EST 2004


[Gerrit]

I am in favour of including something like DatuUtil in the standard library. I need it often enough, e.g., to find out out when two weeks after 24 Feb is is easier with DateUtil than with datetime, ...

[Brett]

And if you want a poor man's way of finding the date a specific number of days past a date you can add those number of days to the day of the year value and then pass in the year and day of year into strptime and it will calculate the new date for you. Roundabout, yes, but it works. =) Obviously DateUtil is a much better way to handle this.

I'm not grasping the perceived difficulty with this specific use case:

import datetime datetime.date(2004, 2, 24) + datetime.timedelta(weeks=2) datetime.date(2004, 3, 9)

I suppose it's possible that Gerrit finds "relativedelta" easier to type for some reason .



More information about the Python-Dev mailing list