DateTime Objects
Various date and time objects are supplied by the :mod:`datetime` module. Before using any of these functions, the header file :file:`datetime.h` must be included in your source (note that this is not included by :file:`Python.h`), and the macro :cmacro:`PyDateTime_IMPORT` must be invoked, usually as part of the module initialisation function. The macro puts a pointer to a C structure into a static variable, :cdata:`PyDateTimeAPI`, that is used by the following macros.
Type-check macros:
Macros to create objects:
Macros to extract fields from date objects. The argument must be an instance of :cdata:`PyDateTime_Date`, including subclasses (such as :cdata:`PyDateTime_DateTime`). The argument must not be NULL, and the type is not checked:
Macros to extract fields from datetime objects. The argument must be an instance of :cdata:`PyDateTime_DateTime`, including subclasses. The argument must not be NULL, and the type is not checked:
Macros to extract fields from time objects. The argument must be an instance of :cdata:`PyDateTime_Time`, including subclasses. The argument must not be NULL, and the type is not checked:
Macros for the convenience of modules implementing the DB API: