Wynn Netherland changelog.com/posts

times - Handle time and timezones simply in Python

Update: Check out Vincent’s blog post for background.

Vincent Driessen, author of gitflow, has released Times, a time and timezones library for Python. Times builds on pytz and aims to simplify time and timezone handling. When handling time with Times, convert time to universal time first:

>>> times.to_universal(local_time, 'Europe/Amsterdam')
datetime.datetime(2012, 2, 1, 10, 31, 45, 781262)

When displaying time for a user, format it with their local time zone:

>>> print times.format(now, 'CET')
2012-02-01 21:32:10+0100

See the README for advanced usage. Oh, and why aren’t you using git flow?


Sign in or Join to comment or subscribe

Player art
  0:00 / 0:00