Stéphane Wirtel | cbb6484 | 2019-05-17 11:55:34 +0200 | [diff] [blame] | 1 | .. highlight:: c |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 2 | |
| 3 | .. _datetimeobjects: |
| 4 | |
| 5 | DateTime Objects |
| 6 | ---------------- |
| 7 | |
| 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 |
| 10 | included in your source (note that this is not included by :file:`Python.h`), |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 11 | and the macro :c:macro:`PyDateTime_IMPORT` must be invoked, usually as part of |
Alexander Belopolsky | 56303e0 | 2010-06-26 02:15:07 +0000 | [diff] [blame] | 12 | the module initialisation function. The macro puts a pointer to a C structure |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 13 | into a static variable, :c:data:`PyDateTimeAPI`, that is used by the following |
Alexander Belopolsky | 1341f57 | 2010-06-26 18:57:02 +0000 | [diff] [blame] | 14 | macros. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 15 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 16 | Macro for access to the UTC singleton: |
| 17 | |
| 18 | .. c:var:: PyObject* PyDateTime_TimeZone_UTC |
| 19 | |
| 20 | Returns the time zone singleton representing UTC, the same object as |
| 21 | :attr:`datetime.timezone.utc`. |
| 22 | |
| 23 | .. versionadded:: 3.7 |
| 24 | |
| 25 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 26 | Type-check macros: |
| 27 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 28 | .. c:function:: int PyDate_Check(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 29 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 30 | Return true if *ob* is of type :c:data:`PyDateTime_DateType` or a subtype of |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 31 | :c:data:`PyDateTime_DateType`. *ob* must not be ``NULL``. This function always |
| 32 | succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 33 | |
| 34 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 35 | .. c:function:: int PyDate_CheckExact(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 36 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 37 | Return true if *ob* is of type :c:data:`PyDateTime_DateType`. *ob* must not be |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 38 | ``NULL``. This function always succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 39 | |
| 40 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 41 | .. c:function:: int PyDateTime_Check(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 42 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 43 | Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType` or a subtype of |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 44 | :c:data:`PyDateTime_DateTimeType`. *ob* must not be ``NULL``. This function always |
| 45 | succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 46 | |
| 47 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 48 | .. c:function:: int PyDateTime_CheckExact(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 49 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 50 | Return true if *ob* is of type :c:data:`PyDateTime_DateTimeType`. *ob* must not |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 51 | be ``NULL``. This function always succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 52 | |
| 53 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 54 | .. c:function:: int PyTime_Check(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 55 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 56 | Return true if *ob* is of type :c:data:`PyDateTime_TimeType` or a subtype of |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 57 | :c:data:`PyDateTime_TimeType`. *ob* must not be ``NULL``. This function always |
| 58 | succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 59 | |
| 60 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 61 | .. c:function:: int PyTime_CheckExact(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 62 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 63 | Return true if *ob* is of type :c:data:`PyDateTime_TimeType`. *ob* must not be |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 64 | ``NULL``. This function always succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 65 | |
| 66 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 67 | .. c:function:: int PyDelta_Check(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 68 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 69 | Return true if *ob* is of type :c:data:`PyDateTime_DeltaType` or a subtype of |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 70 | :c:data:`PyDateTime_DeltaType`. *ob* must not be ``NULL``. This function always |
| 71 | succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 72 | |
| 73 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 74 | .. c:function:: int PyDelta_CheckExact(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 75 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 76 | Return true if *ob* is of type :c:data:`PyDateTime_DeltaType`. *ob* must not be |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 77 | ``NULL``. This function always succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 78 | |
| 79 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 80 | .. c:function:: int PyTZInfo_Check(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 81 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 82 | Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType` or a subtype of |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 83 | :c:data:`PyDateTime_TZInfoType`. *ob* must not be ``NULL``. This function always |
| 84 | succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 85 | |
| 86 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 87 | .. c:function:: int PyTZInfo_CheckExact(PyObject *ob) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 88 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 89 | Return true if *ob* is of type :c:data:`PyDateTime_TZInfoType`. *ob* must not be |
Antonio Cuni | 315fc52 | 2021-01-06 12:38:26 +0100 | [diff] [blame] | 90 | ``NULL``. This function always succeeds. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 91 | |
| 92 | |
| 93 | Macros to create objects: |
| 94 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 95 | .. c:function:: PyObject* PyDate_FromDate(int year, int month, int day) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 96 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 97 | Return a :class:`datetime.date` object with the specified year, month and day. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 98 | |
| 99 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 100 | .. c:function:: PyObject* PyDateTime_FromDateAndTime(int year, int month, int day, int hour, int minute, int second, int usecond) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 101 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 102 | Return a :class:`datetime.datetime` object with the specified year, month, day, hour, |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 103 | minute, second and microsecond. |
| 104 | |
| 105 | |
Edison A | 5765ecf | 2019-05-07 08:00:21 -0700 | [diff] [blame] | 106 | .. c:function:: PyObject* PyDateTime_FromDateAndTimeAndFold(int year, int month, int day, int hour, int minute, int second, int usecond, int fold) |
| 107 | |
| 108 | Return a :class:`datetime.datetime` object with the specified year, month, day, hour, |
| 109 | minute, second, microsecond and fold. |
| 110 | |
| 111 | .. versionadded:: 3.6 |
| 112 | |
| 113 | |
Edison A | d28772a | 2019-05-13 00:23:38 -0700 | [diff] [blame] | 114 | .. c:function:: PyObject* PyTime_FromTime(int hour, int minute, int second, int usecond) |
| 115 | |
| 116 | Return a :class:`datetime.time` object with the specified hour, minute, second and |
| 117 | microsecond. |
| 118 | |
| 119 | |
Edison A | 5765ecf | 2019-05-07 08:00:21 -0700 | [diff] [blame] | 120 | .. c:function:: PyObject* PyTime_FromTimeAndFold(int hour, int minute, int second, int usecond, int fold) |
| 121 | |
| 122 | Return a :class:`datetime.time` object with the specified hour, minute, second, |
| 123 | microsecond and fold. |
| 124 | |
| 125 | .. versionadded:: 3.6 |
| 126 | |
| 127 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 128 | .. c:function:: PyObject* PyDelta_FromDSU(int days, int seconds, int useconds) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 129 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 130 | Return a :class:`datetime.timedelta` object representing the given number |
| 131 | of days, seconds and microseconds. Normalization is performed so that the |
| 132 | resulting number of microseconds and seconds lie in the ranges documented for |
| 133 | :class:`datetime.timedelta` objects. |
| 134 | |
| 135 | .. c:function:: PyObject* PyTimeZone_FromOffset(PyDateTime_DeltaType* offset) |
| 136 | |
| 137 | Return a :class:`datetime.timezone` object with an unnamed fixed offset |
| 138 | represented by the *offset* argument. |
| 139 | |
| 140 | .. versionadded:: 3.7 |
| 141 | |
| 142 | .. c:function:: PyObject* PyTimeZone_FromOffsetAndName(PyDateTime_DeltaType* offset, PyUnicode* name) |
| 143 | |
| 144 | Return a :class:`datetime.timezone` object with a fixed offset represented |
| 145 | by the *offset* argument and with tzname *name*. |
| 146 | |
| 147 | .. versionadded:: 3.7 |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 148 | |
| 149 | |
| 150 | Macros to extract fields from date objects. The argument must be an instance of |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 151 | :c:data:`PyDateTime_Date`, including subclasses (such as |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 152 | :c:data:`PyDateTime_DateTime`). The argument must not be ``NULL``, and the type is |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 153 | not checked: |
| 154 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 155 | .. c:function:: int PyDateTime_GET_YEAR(PyDateTime_Date *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 156 | |
| 157 | Return the year, as a positive int. |
| 158 | |
| 159 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 160 | .. c:function:: int PyDateTime_GET_MONTH(PyDateTime_Date *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 161 | |
| 162 | Return the month, as an int from 1 through 12. |
| 163 | |
| 164 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 165 | .. c:function:: int PyDateTime_GET_DAY(PyDateTime_Date *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 166 | |
| 167 | Return the day, as an int from 1 through 31. |
| 168 | |
| 169 | |
| 170 | Macros to extract fields from datetime objects. The argument must be an |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 171 | instance of :c:data:`PyDateTime_DateTime`, including subclasses. The argument |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 172 | must not be ``NULL``, and the type is not checked: |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 173 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 174 | .. c:function:: int PyDateTime_DATE_GET_HOUR(PyDateTime_DateTime *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 175 | |
| 176 | Return the hour, as an int from 0 through 23. |
| 177 | |
| 178 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 179 | .. c:function:: int PyDateTime_DATE_GET_MINUTE(PyDateTime_DateTime *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 180 | |
| 181 | Return the minute, as an int from 0 through 59. |
| 182 | |
| 183 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 184 | .. c:function:: int PyDateTime_DATE_GET_SECOND(PyDateTime_DateTime *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 185 | |
| 186 | Return the second, as an int from 0 through 59. |
| 187 | |
| 188 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 189 | .. c:function:: int PyDateTime_DATE_GET_MICROSECOND(PyDateTime_DateTime *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 190 | |
| 191 | Return the microsecond, as an int from 0 through 999999. |
| 192 | |
Zackery Spytz | 2e4dd33 | 2020-09-23 12:43:45 -0600 | [diff] [blame] | 193 | .. c:function:: PyObject* PyDateTime_DATE_GET_TZINFO(PyDateTime_DateTime *o) |
| 194 | |
| 195 | Return the tzinfo (which may be ``None``). |
| 196 | |
| 197 | .. versionadded:: 3.10 |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 198 | |
| 199 | Macros to extract fields from time objects. The argument must be an instance of |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 200 | :c:data:`PyDateTime_Time`, including subclasses. The argument must not be ``NULL``, |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 201 | and the type is not checked: |
| 202 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 203 | .. c:function:: int PyDateTime_TIME_GET_HOUR(PyDateTime_Time *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 204 | |
| 205 | Return the hour, as an int from 0 through 23. |
| 206 | |
| 207 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 208 | .. c:function:: int PyDateTime_TIME_GET_MINUTE(PyDateTime_Time *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 209 | |
| 210 | Return the minute, as an int from 0 through 59. |
| 211 | |
| 212 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 213 | .. c:function:: int PyDateTime_TIME_GET_SECOND(PyDateTime_Time *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 214 | |
| 215 | Return the second, as an int from 0 through 59. |
| 216 | |
| 217 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 218 | .. c:function:: int PyDateTime_TIME_GET_MICROSECOND(PyDateTime_Time *o) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 219 | |
| 220 | Return the microsecond, as an int from 0 through 999999. |
| 221 | |
Zackery Spytz | 2e4dd33 | 2020-09-23 12:43:45 -0600 | [diff] [blame] | 222 | .. c:function:: PyObject* PyDateTime_TIME_GET_TZINFO(PyDateTime_Time *o) |
| 223 | |
| 224 | Return the tzinfo (which may be ``None``). |
| 225 | |
| 226 | .. versionadded:: 3.10 |
| 227 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 228 | |
Amaury Forgeot d'Arc | 5e8260b | 2012-01-17 21:31:50 +0100 | [diff] [blame] | 229 | Macros to extract fields from time delta objects. The argument must be an |
| 230 | instance of :c:data:`PyDateTime_Delta`, including subclasses. The argument must |
Serhiy Storchaka | 25fc088 | 2019-10-30 12:03:20 +0200 | [diff] [blame] | 231 | not be ``NULL``, and the type is not checked: |
Amaury Forgeot d'Arc | 5e8260b | 2012-01-17 21:31:50 +0100 | [diff] [blame] | 232 | |
| 233 | .. c:function:: int PyDateTime_DELTA_GET_DAYS(PyDateTime_Delta *o) |
| 234 | |
| 235 | Return the number of days, as an int from -999999999 to 999999999. |
| 236 | |
| 237 | .. versionadded:: 3.3 |
| 238 | |
| 239 | |
| 240 | .. c:function:: int PyDateTime_DELTA_GET_SECONDS(PyDateTime_Delta *o) |
| 241 | |
| 242 | Return the number of seconds, as an int from 0 through 86399. |
| 243 | |
| 244 | .. versionadded:: 3.3 |
| 245 | |
| 246 | |
Phobosmir | 82cd3ce | 2017-11-04 13:39:45 +0300 | [diff] [blame] | 247 | .. c:function:: int PyDateTime_DELTA_GET_MICROSECONDS(PyDateTime_Delta *o) |
Amaury Forgeot d'Arc | 5e8260b | 2012-01-17 21:31:50 +0100 | [diff] [blame] | 248 | |
| 249 | Return the number of microseconds, as an int from 0 through 999999. |
| 250 | |
| 251 | .. versionadded:: 3.3 |
| 252 | |
| 253 | |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 254 | Macros for the convenience of modules implementing the DB API: |
| 255 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 256 | .. c:function:: PyObject* PyDateTime_FromTimestamp(PyObject *args) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 257 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 258 | Create and return a new :class:`datetime.datetime` object given an argument |
| 259 | tuple suitable for passing to :meth:`datetime.datetime.fromtimestamp()`. |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 260 | |
| 261 | |
Georg Brandl | 60203b4 | 2010-10-06 10:11:56 +0000 | [diff] [blame] | 262 | .. c:function:: PyObject* PyDate_FromTimestamp(PyObject *args) |
Georg Brandl | 54a3faa | 2008-01-20 09:30:57 +0000 | [diff] [blame] | 263 | |
Paul Ganssle | 04af5b1 | 2018-01-24 17:29:30 -0500 | [diff] [blame] | 264 | Create and return a new :class:`datetime.date` object given an argument |
| 265 | tuple suitable for passing to :meth:`datetime.date.fromtimestamp()`. |