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.

Source Distribution

human-datetimedelta-0.3.1.tar.gz (1.9 kB view details)

Uploaded Source

File details

Details for the file human-datetimedelta-0.3.1.tar.gz.

File metadata

File hashes

Hashes for human-datetimedelta-0.3.1.tar.gz
Algorithm Hash digest
SHA256 e90cf1d37fd5b8800671383bbdc60cbb300b9628f74f291b0652ba7d1cce46fa
MD5 e808b233c17f724ff8f60dde28fa77fc
BLAKE2b-256 8f0a15215fb58bcde0614a69e0b563cde9335a03b84d9ec14e771214409febd8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page