Skip to main content

2 posts tagged with "timezone"

timezone tag description

View All Tags

Pendulum vs. Python Built-In datetime: Performance, Timezones, and Best Practices

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

Working with dates, times, and timezones in Python often involves choosing between the standard library's built-in datetime module and third-party libraries like Pendulum.

While Python's native datetime provides maximum raw execution speed due to its low-level C implementation, Pendulum provides default timezone awareness, Daylight Saving Time (DST) safety, and an intuitive fluent API for arithmetic and parsing.

This guide provides a comprehensive comparison covering execution benchmarks, architectural differences, timezone safety, and code examples for choosing the right tool.

All Possible Ways to Remove Timezone Information from a Python `datetime` Object

· 7 min read
Serhii Hrekov
Senior Software Engineer & System Architect specializing in Python, Web Systems, Cloud Infrastructure & Automation

A Python datetime object is considered timezone-aware if its tzinfo attribute is set, and timezone-naive if tzinfo is None. Removing timezone information, or "making it naive," is the process of setting this attribute to None.

The key consideration when stripping the timezone is which time value you want to keep: the time as it was originally represented, or the time converted to a standard reference (like UTC or local time) before stripping the timezone.