Skip to main content

Human readable datetime deltas

Project description

Examples:

from datetime import datetime, timedelta

now = datetime.now()
an_hour_ago = now - timedelta(hours=1)
yesterday = now - timedelta(days=1)
tomorrow = now + timedelta(days=1)

import human

print human.date(now)                      # 'now'
print human.date(an_hour_ago)              # 'an hour ago'
print human.date(an_hour_ago, short=True)  # '1h ago'
print human.date(an_hour_ago, asdays=True) # 'today'
print human.date(yesterday, short=True)    # 'yest'
print human.date(tomorrow)                 # 'tomorrow'

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for human-datetimedelta, version 0.2
Filename, size File type Python version Upload date Hashes
Filename, size human-datetimedelta-0.2.tar.gz (1.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page