Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Human readable datetime deltas
Python
branch: master

naivety

latest commit f19763fe92
Terse Col authored
Failed to load latest commit information.
dist put up to pypi
human naivety
MANIFEST put up to pypi
PKG-INFO put up to pypi
README update README
setup.py naivety

README

    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'
Something went wrong with that request. Please try again.