Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Ralf Schmitt <schmir <at> gmail.com>
Subject: timelib 0.2 - parse english textual date descriptions
Newsgroups: gmane.comp.python.announce
Date: Wednesday 24th June 2009 16:17:25 UTC (over 7 years ago)
Hi all,

timelib is a short wrapper around php's internal timelib module.

It currently only provides two functions for parsing textual date
descriptions:

timelib.strtodatetime:

>>> timelib.strtodatetime('today')
datetime.datetime(2009, 6, 23, 0, 0)
>>> timelib.strtodatetime('today')
datetime.datetime(2009, 6, 23, 0, 0)
>>> timelib.strtodatetime('next friday')
datetime.datetime(2009, 6, 26, 0, 0)
>>> timelib.strtodatetime('29 feb 2008 -108 years')
datetime.datetime(1900, 3, 1, 0, 0)

timelib.strtotime:

>>> import time, timelib
>>> time.ctime(timelib.strtotime("now"))
'Tue Jun 23 15:17:32 2009'
>>> time.ctime(timelib.strtotime("4 hours ago"))
'Tue Jun 23 11:17:38 2009'
>>> time.ctime(timelib.strtotime("20080229 -1 year"))
'Thu Mar  1 01:00:00 2007'




timelib is available via PyPI:
http://pypi.python.org/pypi/timelib/

Regards,
- Ralf
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

        Support the Python Software Foundation:
        http://www.python.org/psf/donations/
 
CD: 3ms