What are Python modules for date manipulation?

PythonServer Side ProgrammingProgramming

There are many modules available in both the standard library and the PiPy repository for date manipulation. The most popular among these libraries are the following(in no particular order) −

  • datetime (Standard library) − The datetime module supplies classes for manipulating dates and times in both simple and complex ways. While date and time arithmetic is supported, the focus of the implementation is on efficient attribute extraction for output formatting and manipulation.

  • time(Standard library) − This module provides various time-related functions. Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library functions with the same name.

  • dateutil − The dateutil module provides powerful extensions to the standard datetime module, available in Python 2.3+.

  • mxDateTime − mxDateTime™ is a Python extension package that provides three new objects, DateTime, DateTimeDelta and RelativeDateTime, which let you store and handle date/time values in a much more natural way than by using ticks (seconds since 1.1.1970 0:00 UTC), the representation used by Python's time module.

  • pytz − 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.

Published on 08-Jan-2018 14:44:32