Features
--------
* Computing of relative deltas (next month, next year,
next monday, last week of month, and a lot more);
* Computing of relative deltas between two given
date and/or datetime objects;
* Computing of dates based on very flexible recurrence rules
(every month, every week on Thursday and Friday, every
Friday 13th, and a *LOT* more), using a superset of the
iCalendar RFC specification. Parsing of RFC strings is
supported as well.
* Generic parsing of dates in almost any string format;
* Timezone (tzinfo) implementations for tzfile(5) format
files (/etc/localtime, /usr/share/zoneinfo, etc), TZ
environment string (in all known formats), iCalendar
format files, given ranges (with help from relative deltas),
local machine timezone, fixed offset timezone, and UTC
timezone.
* Computing of Easter Sunday dates for any given year,
using Western, Orthodox or Julian algorithms;
* More than 400 test cases.
Where to get it?
----------------
https://moin.conectiva.com.br/DateUtil
--
Gustavo Niemeyer
http://niemeyer.net
> What is it?
> -----------
> The dateutil module provides powerful extensions to the standard
> datetime module, available in Python 2.3+.
Do you plan to propose it to the core python ? It would be great to
don't have again to change API when the same fonction will be integrated
in the core like it was with mx
Anyway, thanks for your work
--
William Dodé - http://flibuste.net
It will be hard to find something you can't do. :-)
How may work days until the end of the month?
>>> from dateutil.rrule import *
>>> from datetime import *
>>> now = datetime.now()
>>> len(list(rrule(FREQ_DAILY,byweekday=(MO,TU,WE,TH,FR),
dtstart=now,until=now.replace(day=31))))
16
Hummm.. interesting enough, this result is not right. Today should
also be counted in this case. There's a small bug related to
micrseconds handling in the module: since the recurrence is compared
against a date without microseconds, the recurrence is not greater
than the dtstart passed. I haven't got this because all 415 testcases
were using datetime instances without microseconds. Well, we
have 417 now.. ;-)
Here is the right result, with the fix:
>>> len(list(rrule(FREQ_DAILY,byweekday=(MO,TU,WE,TH,FR),
dtstart=now,until=now.replace(day=31))))
17
Thanks!
I don't quite understand. Are you're complaining that someone took
his time to build an internal datetime type? Or are you complaining
that M.-A. Lemburg has written mx.DateTime? :-)
The internal datetime is not the same thing as the mx.DateTime module.
If you're using mx.DateTime, you can keep using it.
Answering your question, yes, I do plan to propose the inclusion
in the core. If it will be included or not, I have no idea.
>> > What is it?
>> > -----------
>> > The dateutil module provides powerful extensions to the standard
>> > datetime module, available in Python 2.3+.
>>
>> Do you plan to propose it to the core python ? It would be great to
>> don't have again to change API when the same fonction will be
>> integrated in the core like it was with mx
>
> I don't quite understand. Are you're complaining that someone took
> his time to build an internal datetime type? Or are you complaining
> that M.-A. Lemburg has written mx.DateTime? :-)
I just complain that such wonderfull tools are not in the core.
>
> The internal datetime is not the same thing as the mx.DateTime module.
> If you're using mx.DateTime, you can keep using it.
I thought they overlap, i'll look more...
>
> Answering your question, yes, I do plan to propose the inclusion
> in the core. If it will be included or not, I have no idea.
Thanks :-)
With this functionality it'll make calculating those bond prices even
more interesting.
--
Robin Becker
-Scott David Daniels
Scott....@Acm.Org
Oh.. Sorry. I'll include it. It's released under the Python
Software Foundation license, the same as Python itself.