ago: Human readable timedeltas
Project description
How to install
easy_install ago
How to use
Import ago and create a timedelta object:
from ago import delta2dict, human from datetime import datetime # pretend this was stored in database d1 = datetime( year = 2010, month=5, day=4, hour=6, minute=54, second=33, microsecond=4000 ) # this is right now d2 = datetime.now() # subtract the two for a timedelta object delta = d2 - d1 # create a dictionary out of the timedelta # not needed but accessable delta_dict = delta2dict( delta ) print delta_dict # display a human readable timedelta print 'Created ' + human( delta ) + ' ago.' # optionally pass a precision print 'Created ' + human( delta, 3 ) + ' ago.' print 'Created ' + human( delta, 6 ) + ' ago.'
How do I thank you?
You should follow me on twitter http://twitter.com/russellbal
License
Public Domain
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ago-0.0.2.tar.gz
(2.0 kB
view details)
Built Distribution
ago-0.0.2-py2.7.egg
(3.0 kB
view details)
File details
Details for the file ago-0.0.2.tar.gz
.
File metadata
- Download URL: ago-0.0.2.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf60be219846e4aead195dc5fff0eba85b9abf3e7740384fc09132889be73958 |
|
MD5 | afe0e91cf230ff2d4e662ae41c8ce88d |
|
BLAKE2b-256 | 89dce2e8cfc404305c2ceef6114ae78bccf29f32b00b2f05bc4a78bee364b71f |
File details
Details for the file ago-0.0.2-py2.7.egg
.
File metadata
- Download URL: ago-0.0.2-py2.7.egg
- Upload date:
- Size: 3.0 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 097917594b1d40a562b886c10a96973288fea7773abeee45911d7ffc8bf079ce |
|
MD5 | 22010c0ffe5b14cfb4623a1d2e355884 |
|
BLAKE2b-256 | 829b25409d8fe0096f36e4bb21ddcf670b702eb7c820bf35b9049ea4dc6b2dc0 |