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

Gustavo Niemeyer niemeyer at conectiva.com
Thu Mar 11 16:59:16 EST 2004


Before I give my vote on DateUtil I know I would love to hear Gustavo give a quick comparison to datetime in terms of what DateUtil provides over datetime. For instance, as Tim showed above (I should have known there was a better way with datetime than with my nutty way of doing it), datetime supports time deltas. So why should we use DateUtil's or what should we try to take from it? Same for parser (compared to strptime) and tz (compared to tzinfo). I could obviously stare at the wiki and datetime docs, but I am sure Gustavo can give a better overview than I could glean on my own.

Here is a quick list of features, from the website:

Please, check the website for complete documentation:

https://moin.conectiva.com.br/DateUtil

The rrule idea does sound cool and could be neat to add to datetime. I can see having an iterator for these things being useful to someone (unless I am making myself partially look like a fool again by having this be in datetime already without me realizing it).

Btw, here is a fun task for rrule:

Every four years, the first Tuesday after a Monday in November, 3 occurrences (U.S. Presidential Election day):

list(rrule(FREQYEARLY, interval=4, count=3, bymonth=11, byweekday=TU, bymonthday=(2,3,4,5,6,7,8), dtstart=parse("19961105T090000"))) [datetime.datetime(1996, 11, 5, 9, 0), datetime.datetime(2000, 11, 7, 9, 0), datetime.datetime(2004, 11, 2, 9, 0)]

-- Gustavo Niemeyer http://niemeyer.net



More information about the Python-Dev mailing list