pendulum
Drop-in datetime replacement with first-class timezone support, DST awareness, and intuitive arithmetic.
Timezone handling in Python is notoriously tricky โ DST transitions, ambiguous local times, and converting between zones are error-prone with stdlib. You want a datetime object that just does the right thing.
pendulum.DateTime is a subclass of Python's datetime โ so it works anywhere datetime does. pendulum.now() always returns a timezone-aware object. Arithmetic respects DST. You get .diff() for precise durations and .in_timezone() for safe conversions.
Work with timezones safely
import pendulum
now_utc = pendulum.now('UTC')
now_nyc = now_utc.in_timezone('America/New_York')
now_tok = now_utc.in_timezone('Asia/Tokyo')
print(now_utc.to_iso8601_string())
print(now_nyc.format('ddd MMM D, h:mm A zz'))
# Arithmetic respects DST
meetingtime = pendulum.datetime(2024, 3, 10, 12, 0, 0, tz='America/New_York')
day_later = meetingtime.add(days=1) # correctly crosses DST boundaryUse it when
Scheduling apps, calendar features, time-series data across timezones, any app where DST bugs would be costly.
Skip it when
Simple UTC-only timestamps where datetime.now(timezone.utc) is sufficient. pendulum is heavier than stdlib.
Ready to explore the full API?
See every class, function, and relationship in an interactive graph.