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')
| 2122 | self._year) |
| 2123 | |
| 2124 | def isoformat(self, sep='T', timespec='auto'): |
| 2125 | """Return the time formatted according to ISO. |
| 2126 | |
| 2127 | The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'. |
| 2128 | By default, the fractional part is omitted if self.microsecond == 0. |
| 2129 | |
| 2130 | If self.tzinfo is not None, the UTC offset is also attached, giving |
| 2131 | a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'. |
| 2132 | |
| 2133 | Optional argument sep specifies the separator between date and |
| 2134 | time, default 'T'. |
| 2135 | |
| 2136 | The optional argument timespec specifies the number of additional |
| 2137 | terms of the time to include. Valid options are 'auto', 'hours', |
| 2138 | 'minutes', 'seconds', 'milliseconds' and 'microseconds'. |
| 2139 | """ |
| 2140 | s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) + |
| 2141 | _format_time(self._hour, self._minute, self._second, |
| 2142 | self._microsecond, timespec)) |
| 2143 | |
| 2144 | off = self.utcoffset() |
| 2145 | tz = _format_offset(off) |
| 2146 | if tz: |
| 2147 | s += tz |
| 2148 | |
| 2149 | return s |
| 2150 | |
| 2151 | def __repr__(self): |
| 2152 | """Convert to formal string, for repr().""" |
no test coverage detected