LEFT | RIGHT |
1 .. highlightlang:: c | 1 .. highlightlang:: c |
2 | 2 |
3 .. _datetimeobjects: | 3 .. _datetimeobjects: |
4 | 4 |
5 DateTime Objects | 5 DateTime Objects |
6 ---------------- | 6 ---------------- |
7 | 7 |
8 Various date and time objects are supplied by the :mod:`datetime` module. | 8 Various date and time objects are supplied by the :mod:`datetime` module. |
9 Before using any of these functions, the header file :file:`datetime.h` must be | 9 Before using any of these functions, the header file :file:`datetime.h` must be |
10 included in your source (note that this is not included by :file:`Python.h`), | 10 included in your source (note that this is not included by :file:`Python.h`), |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 .. cfunction:: PyObject* PyDateTime_FromTimestamp(PyObject *args) | 190 .. cfunction:: PyObject* PyDateTime_FromTimestamp(PyObject *args) |
191 | 191 |
192 Create and return a new ``datetime.datetime`` object given an argument tuple | 192 Create and return a new ``datetime.datetime`` object given an argument tuple |
193 suitable for passing to ``datetime.datetime.fromtimestamp()``. | 193 suitable for passing to ``datetime.datetime.fromtimestamp()``. |
194 | 194 |
195 | 195 |
196 .. cfunction:: PyObject* PyDate_FromTimestamp(PyObject *args) | 196 .. cfunction:: PyObject* PyDate_FromTimestamp(PyObject *args) |
197 | 197 |
198 Create and return a new ``datetime.date`` object given an argument tuple | 198 Create and return a new ``datetime.date`` object given an argument tuple |
199 suitable for passing to ``datetime.date.fromtimestamp()``. | 199 suitable for passing to ``datetime.date.fromtimestamp()``. |
| 200 |
| 201 Macro for module-level function: |
| 202 |
| 203 .. cfunction:: int PyMonth_Mod(PyObject *start, PyObject *end, PyObject **md, Py
Object **td) |
| 204 |
| 205 Create (and return by reference) a :cdata:`PyDateTime_MonthType` and a |
| 206 :cdata:`PyDateTime_DeltaType` from two :cdata:`PyDateTime_DateTypes` or |
| 207 :cdata:`PyDateTime_DatetimeTypes`. After :cfunc:`PyMonth_Mod` returns zero, |
| 208 ``md`` and ``td`` will be addresses of, respectively, a |
| 209 :class:`~datetime.monthdelta` object and a :class:`~datetime.timedelta` |
| 210 object, which together represent the interim between ``start`` and ``end``. |
| 211 In case of error this function will return -1 and will set an appropriate |
| 212 exception. See documentation for :func:`~datetime.monthmod` for more |
| 213 information. |
| 214 |
LEFT | RIGHT |