skip to navigation
skip to content

Not Logged In

timelib 0.2

parse english textual date descriptions

Latest Version: 0.2.4

timelib is a short wrapper around php's internal timelib module. It currently only provides a few functions:

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'
 
File Type Py Version Uploaded on Size
timelib-0.2.tar.gz (md5) Source 2009-06-24 282KB
  • Downloads (All Versions):
  • 687 downloads in the last day
  • 3064 downloads in the last week
  • 9022 downloads in the last month