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

Class date

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

Concrete date type. Constructors: __new__() fromtimestamp() today() fromordinal() Operators: __repr__, __str__ __eq__, __le__, __lt__, __ge__, __gt__, __hash__ __add__, __radd__, __sub__ (add/radd only with timedelta arg) Methods: ti

Source from the content-addressed store, hash-verified

891timedelta.resolution = timedelta(microseconds=1)
892
893class date:
894 """Concrete date type.
895
896 Constructors:
897
898 __new__()
899 fromtimestamp()
900 today()
901 fromordinal()
902
903 Operators:
904
905 __repr__, __str__
906 __eq__, __le__, __lt__, __ge__, __gt__, __hash__
907 __add__, __radd__, __sub__ (add/radd only with timedelta arg)
908
909 Methods:
910
911 timetuple()
912 toordinal()
913 weekday()
914 isoweekday(), isocalendar(), isoformat()
915 ctime()
916 strftime()
917
918 Properties (readonly):
919 year, month, day
920 """
921 __slots__ = '_year', '_month', '_day', '_hashcode'
922
923 def __new__(cls, year, month=None, day=None):
924 """Constructor.
925
926 Arguments:
927
928 year, month, day (required, base 1)
929 """
930 if (month is None and
931 isinstance(year, (bytes, str)) and len(year) == 4 and
932 1 <= ord(year[2:3]) <= 12):
933 # Pickle support
934 if isinstance(year, str):
935 try:
936 year = year.encode('latin1')
937 except UnicodeEncodeError:
938 # More informative error message.
939 raise ValueError(
940 "Failed to encode latin1 string when unpickling "
941 "a date object. "
942 "pickle.load(data, encoding='latin1') is assumed.")
943 self = object.__new__(cls)
944 self.__setstate(year)
945 self._hashcode = -1
946 return self
947 year, month, day = _check_date_fields(year, month, day)
948 self = object.__new__(cls)
949 self._year = year
950 self._month = month

Callers 5

match_to_datetimeFunction · 0.90
match_to_datetimeFunction · 0.90
match_to_datetimeFunction · 0.90
datetime.pyFile · 0.85
dateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected