MCPcopy Index your code
hub / github.com/RustPython/RustPython / isoformat

Method isoformat

Lib/_pydatetime.py:2124–2149  ·  view source on GitHub ↗

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')

Source from the content-addressed store, hash-verified

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()."""

Callers 1

__str__Method · 0.95

Calls 3

utcoffsetMethod · 0.95
_format_timeFunction · 0.85
_format_offsetFunction · 0.85

Tested by

no test coverage detected