Skip to content

Latest commit

 

History

History
268 lines (139 loc) · 8.16 KB

datetime.rst

File metadata and controls

268 lines (139 loc) · 8.16 KB

c

DateTime Objects

Various date and time objects are supplied by the datetime module. Before using any of these functions, the header file datetime.h must be included in your source (note that this is not included by Python.h), and the macro :cPyDateTime_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, :cPyDateTimeAPI, that is used by the following macros.

Macro for access to the UTC singleton:

Type-check macros:

Macros to create objects:

Macros to extract fields from date objects. The argument must be an instance of :cPyDateTime_Date, including subclasses (such as :cPyDateTime_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 :cPyDateTime_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 :cPyDateTime_Time, including subclasses. The argument must not be NULL, and the type is not checked:

Macros to extract fields from time delta objects. The argument must be an instance of :cPyDateTime_Delta, including subclasses. The argument must not be NULL, and the type is not checked:

Macros for the convenience of modules implementing the DB API: