Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between pytz and python-dateutil? [closed]

Tags:

I'm trying to implement timezone awareness in my Python application, and I have come across two different Python modules that implement this feature: pytz and python-dateutil. I'm wondering what the difference between these two modules?

(pytz) http://pytz.sourceforge.net/

(python-dateutil) http://labix.org/python-dateutil

like image 522
fangsterr Avatar asked Mar 18 '12 02:03

fangsterr


People also ask

Is pytz obsolete?

Note: pytz is now obsolete (since two weeks), so with Python 3.9 you can uses directly standard libraries.

How does pytz work?

Introduction. pytz brings the Olson tz database into Python. This library allows accurate and cross platform timezone calculations using Python 2.4 or higher. It also solves the issue of ambiguous times at the end of daylight saving time, which you can read more about in the Python Library Reference ( datetime.


2 Answers

This article gives a nice overview of the differences between the two libraries, with the biggest difference apparently being the correctness of DST edge cases (where dateutil.tz has advantage).

like image 111
Berislav Lopac Avatar answered Oct 15 '22 15:10

Berislav Lopac


They both provide useful support for dealing with timezones. I've personally used pytz in my django applications and found it useful and easy to work with. Hope my two cents helps.

like image 22
Peter Tseng Avatar answered Oct 15 '22 15:10

Peter Tseng