Python datetimes made easy
Alternatives To Pendulum
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Dayjs44,1735,37111,4143 days ago122July 01, 2023808mitJavaScript
⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
Date Fns32,35968,28011,1583 days ago180April 30, 2023628mitTypeScript
⏳ Modern JavaScript date utility library ⌛️
Awesome Falsehood22,086
13 days ago4cc0-1.0
😱 Falsehoods Programmers Believe in
Luxon14,2601,9363,12114 days ago139March 04, 2023144mitJavaScript
⏱ A library for working with dates and times in JS
Arrow8,3723,7111,031a day ago63September 03, 202297apache-2.0Python
🏹 Better dates & times for Python
Pickadate.js7,727172383 months ago18May 31, 2019311mitJavaScript
The mobile-friendly, responsive, and lightweight jQuery date & time input picker.
6633 years ago13September 28, 2017118mitObjective-C
Dates and times made easy in iOS
Pendulum5,711540662a day ago53November 23, 2022229mitPython
Python datetimes made easy
Joda Time4,93631,2695,88314 days ago58March 30, 202344apache-2.0Java
Joda-Time is the widely used replacement for the Java date and time classes prior to Java SE 8.
Carbon3,479365 days ago112November 06, 20223mitGo
A simple, semantic and developer-friendly golang package for datetime
Alternatives To Pendulum
Select To Compare

Alternative Project Comparisons


Pendulum Build status

Python datetimes made easy.

Supports Python 3.8 and newer.

>>> import pendulum

>>> now_in_paris ='Europe/Paris')
>>> now_in_paris

# Seamless timezone switching
>>> now_in_paris.in_timezone('UTC')

>>> tomorrow =
>>> last_week =

>>> past =
>>> past.diff_for_humans()
'2 minutes ago'

>>> delta = past - last_week
>>> delta.hours
>>> delta.in_words(locale='en')
'6 days 23 hours 58 minutes'

# Proper handling of datetime normalization
>>> pendulum.datetime(2013, 3, 31, 2, 30, tz='Europe/Paris')
'2013-03-31T03:30:00+02:00' # 2:30 does not exist (Skipped time)

# Proper handling of dst transitions
>>> just_before = pendulum.datetime(2013, 3, 31, 1, 59, 59, 999999, tz='Europe/Paris')
>>> just_before.add(microseconds=1)


Why Pendulum?

Native datetime instances are enough for basic cases but when you face more complex use-cases they often show limitations and are not so intuitive to work with. Pendulum provides a cleaner and more easy to use API while still relying on the standard library. So it's still datetime but better.

Unlike other datetime libraries for Python, Pendulum is a drop-in replacement for the standard datetime class (it inherits from it), so, basically, you can replace all your datetime instances by DateTime instances in you code (exceptions exist for libraries that check the type of the objects by using the type function like sqlite3 or PyMySQL for instance).

It also removes the notion of naive datetimes: each Pendulum instance is timezone-aware and by default in UTC for ease of use.

Pendulum also improves the standard timedelta class by providing more intuitive methods and properties.


Even though the DateTime class is a subclass of datetime there are some rare cases where it can't replace the native class directly. Here is a list (non-exhaustive) of the reported cases with a possible solution, if any:

  • sqlite3 will use the type() function to determine the type of the object by default. To work around it you can register a new adapter:
from pendulum import DateTime
from sqlite3 import register_adapter

register_adapter(DateTime, lambda val: val.isoformat(' '))
  • mysqlclient (former MySQLdb) and PyMySQL will use the type() function to determine the type of the object by default. To work around it you can register a new adapter:
import MySQLdb.converters
import pymysql.converters

from pendulum import DateTime

MySQLdb.converters.conversions[DateTime] = MySQLdb.converters.DateTime2literal
pymysql.converters.conversions[DateTime] = pymysql.converters.escape_datetime
  • django will use the isoformat() method to store datetimes in the database. However since pendulum is always timezone aware the offset information will always be returned by isoformat() raising an error, at least for MySQL databases. To work around it you can either create your own DateTimeField or use the previous workaround for MySQLdb:
from django.db.models import DateTimeField as BaseDateTimeField
from pendulum import DateTime

class DateTimeField(BaseDateTimeField):

    def value_to_string(self, obj):
        val = self.value_from_object(obj)

        if isinstance(value, DateTime):
            return value.to_datetime_string()

        return '' if val is None else val.isoformat()


Contributions are welcome, especially with localization.

Getting started

To work on the Pendulum codebase, you'll want to clone the project locally and install the required dependencies via poetry.

$ git clone [email protected]:sdispater/pendulum.git
$ poetry install


If you want to help with localization, there are two different cases: the locale already exists or not.

If the locale does not exist you will need to create it by using the clock utility:

./clock locale create <your-locale>

It will generate a directory in pendulum/locales named after your locale, with the following structure:


The file must not be modified. It contains the translations provided by the CLDR database.

The file is the one you want to modify. It contains the data needed by Pendulum that are not provided by the CLDR database. You can take the en data as a reference to see which data is needed.

You should also add tests for the created or modified locale.

Popular Date Projects
Popular Time Projects
Popular Libraries Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Date Time