Pendulum – Python datetimes made easy
Pendulum is a new library for Python to ease datetimes, timedeltas and timezones manipulation.<p>It is heavily inspired by [Carbon](<a href="http://carbon.nesbot.com" rel="nofollow">http://carbon.nesbot.com</a>) for PHP.<p>Basically, the Pendulum class is a replacement for the native datetime one with some useful and intuitive methods, the Interval class is intended to be a better time delta class and, finally, the Period class is a datetime-aware timedelta.<p>Timezones are also easier to deal with: Pendulum will automatically normalize your datetime to handle DST transitions for you.<p><pre><code>    import pendulum
    
    pendulum.create(2013, 3, 31, 2, 30, 0, 0, 'Europe/Paris’)
    # 2:30 for the 31th of March 2013 does not exist
    # so pendulum will return the actual time which is 3:30+02:00
    '2013-03-31T03:30:00+02:00’
    
    dt = pendulum.create(2013, 3, 31, 1, 59, 59, 999999, 'Europe/Paris’)
    '2013-03-31T01:59:59.999999+01:00’
    dt = dt.add(microseconds=1)
    '2013-03-31T03:00:00+02:00’
    dt.subtract(microseconds=1)
    '2013-03-31T01:59:59.999998+01:00’
</code></pre>
To those wondering: yes I know [Arrow](<a href="http://crsmithdev.com/arrow/" rel="nofollow">http://crsmithdev.com/arrow/</a>) exists but its flaws and strange API (you can throw almost anything at get() and it will do its best to determine what you wanted, for instance) motivated me to start this project. You can check why I think Arrow is flawed here: <a href="https://pendulum.eustace.io/faq/#why-not-arrow" rel="nofollow">https://pendulum.eustace.io/faq/#why-not-arrow</a><p>Link to the official documentation: <a href="https://pendulum.eustace.io/docs/" rel="nofollow">https://pendulum.eustace.io/docs/</a><p>Link to the github project: <a href="https://github.com/sdispater/pendulum" rel="nofollow">https://github.com/sdispater/pendulum</a>