Return the time formatted according to ISO. The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. By default, the fractional part is omitted if self.microsecond == 0. If self.tzinfo is not None, the UTC offset is also attached, giving a full format of 'YYYY-MM-DD
(self, sep='T', timespec='auto')
| 2161 | self._year) |
| 2162 | |
| 2163 | def isoformat(self, sep='T', timespec='auto'): |
| 2164 | """Return the time formatted according to ISO. |
| 2165 | |
| 2166 | The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. |
| 2167 | By default, the fractional part is omitted if self.microsecond == 0. |
| 2168 | |
| 2169 | If self.tzinfo is not None, the UTC offset is also attached, giving |
| 2170 | a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'. |
| 2171 | |
| 2172 | Optional argument sep specifies the separator between date and |
| 2173 | time, default 'T'. |
| 2174 | |
| 2175 | The optional argument timespec specifies the number of additional |
| 2176 | terms of the time to include. Valid options are 'auto', 'hours', |
| 2177 | 'minutes', 'seconds', 'milliseconds' and 'microseconds'. |
| 2178 | """ |
| 2179 | s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) + |
| 2180 | _format_time(self._hour, self._minute, self._second, |
| 2181 | self._microsecond, timespec)) |
| 2182 | |
| 2183 | off = self.utcoffset() |
| 2184 | tz = _format_offset(off) |
| 2185 | if tz: |
| 2186 | s += tz |
| 2187 | |
| 2188 | return s |
| 2189 | |
| 2190 | def __repr__(self): |
| 2191 | """Convert to formal string, for repr().""" |
no test coverage detected