mxDateTime

mxDateTime - Date/Time Library for Python

Provides the most natural and robust way of dealing with date/time values in Python.
Version: 3.2.9

Introduction

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.

You can add, subtract and even multiply instances, pickle and copy them and convert the results to strings, COM dates, ticks and some other more esoteric values. In addition, there are several convenient constructors and formatters at hand to greatly simplify dealing with dates and times in real-world applications.

In addition to providing an easy-to-use Python interface the package also exports a comfortable C API interface for other Python extensions to build upon. This is especially interesting for database applications which often have to deal with date/time values. The mxODBC package is an example of a Python extension using this interface.

mxDateTime can convert between various different date/time storage formats, including COM dates, TJD, MJD, JDN, tuples and, probably most important, strings.

The date/time parser included in mxDateTime is one of the most flexible such parsers available for Python. It is constantly being improved to make parsing date/time strings as easy as possible. At the same time, it offers a fully customizable interface which allows selecting valid date/time formats from a range of predefined categories.

There are also special parser and formatter modules for ARPA and ISO date/time formats, which are handy if you work a lot with Internet standards.

Features

  • Parses date/time string values in an almost seamless way.
  • Provides conversion routines to and from many different alternative date/time storage formats.
  • Includes an easy-to-use C API which makes integration a breeze.
  • Fast, memory efficient, accurate.
  • Georgian and Julian calendar support.
  • Vast range of valid dates (including B.C. dates).
  • Compatible to Python's datetime and time modules.
  • Stable, robust and portable (mxDateTime has been around for almost 15 years now).
  • Free to use and redistribute.
  • Fully interoperates with Python's time and datetime modules.

System Requirements

mxDateTime is written in a very portable way and works on pretty much all platforms where you can compile Python.

We provide precompiled versions of mxDateTime for all standard platforms, so all you need is a working Python installation.

The only requirement for compiling the package from source is an ANSI C compiler. There are no third-party libraries needed.

License

mxDateTime is provided as part of the eGenix.com mx Base Distribution. Please see the mx Base Distribution page for details regarding the license.

Documentation

The following documentation is available for mxDateTime:

mxDateTime User Manual and Reference Guide - HTML and PDF

The manual includes a discussion of the design principles behind mxDateTime, its implementation, as well as a reference of the available programming interfaces.

The PDF file is also available as part of the installation and can be found in the mx/DateTime/Doc/ folder.

Books

"Python Programming On Win32" by Mark Hammond, Andy Robinson has a section on mxODBC and mxDateTime.

Download & Installation

mxDateTime is provided as part of the eGenix.com mx Base Distribution. Please see the mx Base Distribution page for downloads and installation instructions.

References

mxDateTime is used in our mxODBC products and by quite a few other third-party database modules. For many years it was the only alternative to Python's time module and is one of the recommended date/time implementations in Python's Database API Specification 2.0.

mxDateTime is also used throughout our own software products as well as many mission critical third-party applications, such as the popular OpenERP enterprise management suite.

History & Changes

Please see the change log for details regarding changes to the package between releases.