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

Method fromisoformat

tools/python-3.11.9-amd64/Lib/datetime.py:980–991  ·  view source on GitHub ↗

Construct a date from a string in ISO 8601 format.

(cls, date_string)

Source from the content-addressed store, hash-verified

978
979 @classmethod
980 def fromisoformat(cls, date_string):
981 """Construct a date from a string in ISO 8601 format."""
982 if not isinstance(date_string, str):
983 raise TypeError('fromisoformat: argument must be str')
984
985 if len(date_string) not in (7, 8, 10):
986 raise ValueError(f'Invalid isoformat string: {date_string!r}')
987
988 try:
989 return cls(*_parse_isoformat_date(date_string))
990 except Exception:
991 raise ValueError(f'Invalid isoformat string: {date_string!r}')
992
993 @classmethod
994 def fromisocalendar(cls, year, week, day):

Callers 1

_convert_dateFunction · 0.45

Calls 1

_parse_isoformat_dateFunction · 0.85

Tested by

no test coverage detected