日期时间对象 ¶
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.
-
PyTypeObject
PyDateTime_DateType
¶
-
此实例的
PyTypeObjectrepresents the Python date type; it is the same object asdatetime.date在 Python 层。
-
PyTypeObject
PyDateTime_DateTimeType
¶
-
此实例的
PyTypeObjectrepresents the Python datetime type; it is the same object asdatetime.datetime在 Python 层。
-
PyTypeObject
PyDateTime_TimeType
¶
-
此实例的
PyTypeObjectrepresents the Python time type; it is the same object asdatetime.time在 Python 层。
-
PyTypeObject
PyDateTime_DeltaType
¶
-
此实例的
PyTypeObjectrepresents Python type for the difference between two datetime values; it is the same object asdatetime.timedelta在 Python 层。
-
PyTypeObject
PyDateTime_TZInfoType
¶
-
此实例的
PyTypeObjectrepresents the Python time zone info type; it is the same object asdatetime.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 版添加。