A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-March/043105.html below:

[Python-Dev] dateutil

[Python-Dev] dateutilRobert Brewer fumanchu at amor.org
Fri Mar 12 11:08:04 EST 2004
Brett C. wrote:
> Responding to both Tim's and Gustavo's follow-ups to my email here.
>8 
> Personally I would 
> love for datetime objects to have a class method to be able 
> to take in 
> the appropriate ISO-formatted date/time string and return the 
> appropriate datetime object.  Otherwise I would rather keep the 
> interface clean of string parsing short of using strptime .

I use:

def datefromiso(isoString, todayOnError=True):
    try:
        args = tuple(map(int, isoString.split(u'-')))
        return datetime.date(*args)
    except (TypeError, ValueError), x:
        if todayOnError:
            return datetime.date.today()
        else:
            raise x

def timefromiso(isoString, zeroOnError=True):
    try:
        args = tuple(map(int, isoString.split(u':')))
        return datetime.time(*args)
    except (TypeError, ValueError), x:
        if zeroOnError:
            return datetime.time(0)
        else:
            raise x


>  > * Computing of Easter Sunday dates for any given year,
>  >   using Western, Orthodox or Julian algorithms;
> 
> Don't really see the use in this other than the rule figuring 
> this out 
> is odd enough that I never remember.  Who really cares when Easter is 
> beyond certain religious groups?

Lots of schools still structure Spring Break around Easter...since my
org works with youth to a large extent, that means we do about 1/8 of
our business for the year during Palm Sunday week and Easter week. Just
an example.


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4