日期时间对象

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 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, PyDateTimeAPI , that is used by the following macros.

type PyDateTime_Date

此子类型的 PyObject represents a Python date object.

type PyDateTime_DateTime

此子类型的 PyObject represents a Python datetime object.

type PyDateTime_Time

此子类型的 PyObject represents a Python time object.

type PyDateTime_Delta

此子类型的 PyObject represents the difference between two datetime values.

PyTypeObject PyDateTime_DateType

此实例的 PyTypeObject represents the Python date type; it is the same object as datetime.date 在 Python 层。

PyTypeObject PyDateTime_DateTimeType

此实例的 PyTypeObject represents the Python datetime type; it is the same object as datetime.datetime 在 Python 层。

PyTypeObject PyDateTime_TimeType

此实例的 PyTypeObject represents the Python time type; it is the same object as datetime.time 在 Python 层。

PyTypeObject PyDateTime_DeltaType

此实例的 PyTypeObject represents Python type for the difference between two datetime values; it is the same object as datetime.timedelta 在 Python 层。

PyTypeObject PyDateTime_TZInfoType

此实例的 PyTypeObject represents the Python time zone info type; it is the same object as datetime.tzinfo 在 Python 层。

Macro for access to the UTC singleton:

PyObject * PyDateTime_TimeZone_UTC

Returns the time zone singleton representing UTC, the same object as datetime.timezone.utc .

3.7 版添加。