Python – Pendulum

Working with dates and times in programming can be a painful test at times. In Python, there are some excellent libraries that help with all the pain, and recently I became aware of Pendulum. It is effectively are replacement for the standard datetime class and it has a number of improvements. Check out the documentation for further information.

Installation of the packages is straightforward with pip:

For example, some simple manipulations involving time zones:

Duration can be used as a replacement for the standard timedelta class:

It also supports the definition of a period, i.e. a duration that is aware of the DateTime instances that created it. For example:

Give it a go, and let me know what you think of it. 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.