O'Reilly logo

Python Programming On Win32 by Mark Hammond, Andy Robinson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

mxDateTime

mxDateTime provides three new object types, DateTime, DateTimeDelta, and RelativeDateTime, which let you store and handle date/time values in a more natural way than by using Unix ticks (seconds since 1.1.70 0:00 UTC, the encoding used by the standard Python time module). We’ll see this used in Chapter 13.

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

Besides providing an easy-to-use Python interface, the package also exports a comfortable C API interface for other extensions to build on. This is especially interesting for database applications that often have to deal with date/time values; the mxODBC package is one example of an extension using this interface.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required