Skip to content

colwilson/human-datetimedelta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

    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'

About

Human readable datetime deltas

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages