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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access