MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / isoformat

Method isoformat

tools/python-3.11.9-amd64/Lib/datetime.py:2005–2030  ·  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 giving a full format o

(self, sep='T', timespec='auto')

Source from the content-addressed store, hash-verified

2003 self._year)
2004
2005 def isoformat(self, sep='T', timespec='auto'):
2006 """Return the time formatted according to ISO.
2007
2008 The full format looks like 'YYYY-MM-DD HH:MM:SS.mmmmmm'.
2009 By default, the fractional part is omitted if self.microsecond == 0.
2010
2011 If self.tzinfo is not None, the UTC offset is also attached, giving
2012 giving a full format of 'YYYY-MM-DD HH:MM:SS.mmmmmm+HH:MM'.
2013
2014 Optional argument sep specifies the separator between date and
2015 time, default 'T'.
2016
2017 The optional argument timespec specifies the number of additional
2018 terms of the time to include. Valid options are 'auto', 'hours',
2019 'minutes', 'seconds', 'milliseconds' and 'microseconds'.
2020 """
2021 s = ("%04d-%02d-%02d%c" % (self._year, self._month, self._day, sep) +
2022 _format_time(self._hour, self._minute, self._second,
2023 self._microsecond, timespec))
2024
2025 off = self.utcoffset()
2026 tz = _format_offset(off)
2027 if tz:
2028 s += tz
2029
2030 return s
2031
2032 def __repr__(self):
2033 """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