magicdate 0.1.3
Convert fuzzy date to a datetime object.
Convert from fuzzy dates like "yesterday", "2 weeks and 1 day ago", "next wed", "Jan 4", etc., to a datetime object.
This is useful for processing command line arguments:
>>> from optparse import OptionParser
>>> import magicdate
>>> parser = OptionParser(option_class=magicdate.MagicDateOption)
>>> parser.add_option('-s', '--start', dest='start', type='magicdate', default=None)
>>> parser.add_option('-e', '--end', dest='end', type='magicdate', default='today')
Now you can pass options like "today", "1996-01-01", etc., to your program.
Inspired by Simon Willison's dateparse.js.
| File | Type | Py Version | Uploaded on | Size | # downloads |
|---|---|---|---|---|---|
| magicdate-0.1.3.tar.gz (md5) | Source | 2008-02-15 17:29:07 | 2KB | 1110 | |
| magicdate-0.1.3-py2.5.egg (md5) | Python Egg | 2.5 | 2008-02-15 17:29:08 | 5KB | 326 |
- Author: Roberto De Almeida <rob at pydap org>
- Download URL: http://cheeseshop.python.org/packages/source/m/magicdate/magicdate-0.1.3.tar.gz
- Keywords: datetime time
- License: MIT
- Categories
- Package Index Owner: roberto
- DOAP record: magicdate-0.1.3.xml
Log in to rate this package.
