Date/time support in pyhton

scott smarsh at hotmail.com
Tue May 15 19:29:16 EDT 2001


Paolo Salvan wrote:

> Hi all!
>
> ...one question: is there in the wide standard python library suport for
> date/time handling?
>
> Can I get a date, add 15 month to it, get the difference (in days,
> months, years) betweeen this date and another date, etc....????
>
> I've heard of (...too...) powerful add-on libs, but I think that basic
> date/time support should be present in the standard library...
>
> ...some opinion????
>                                                     Paolo
>
>

Not in the standard library, but does this sound appropriate for your needs?

class NormalDate:
    """
    NormalDate is a specialized class to handle dates without
    all the excess baggage (time zones, daylight savings, leap
    seconds, etc.) of other date structures.  The minimalist
    strategy greatly simplifies its implementation and use.
    (snip)

e.g.
>>> import normalDate
>>> then = ND(20000215)
>>> now = ND(20010515)
>>> diff = now - then
>>> diff
455

See:  http://www.vex.net/parnassus/apyllo.py?find=normalDate





More information about the Python-list mailing list