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

Class datetime

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

datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]]) The year, month and day arguments are required. tzinfo may be None, or an instance of a tzinfo subclass. The remaining arguments may be ints.

Source from the content-addressed store, hash-verified

1663
1664
1665class datetime(date):
1666 """datetime(year, month, day[, hour[, minute[, second[, microsecond[,tzinfo]]]]])
1667
1668 The year, month and day arguments are required. tzinfo may be None, or an
1669 instance of a tzinfo subclass. The remaining arguments may be ints.
1670 """
1671 __slots__ = date.__slots__ + time.__slots__
1672
1673 def __new__(cls, year, month=None, day=None, hour=0, minute=0, second=0,
1674 microsecond=0, tzinfo=None, *, fold=0):
1675 if (isinstance(year, (bytes, str)) and len(year) == 10 and
1676 1 <= ord(year[2:3])&0x7F <= 12):
1677 # Pickle support
1678 if isinstance(year, str):
1679 try:
1680 year = bytes(year, 'latin1')
1681 except UnicodeEncodeError:
1682 # More informative error message.
1683 raise ValueError(
1684 "Failed to encode latin1 string when unpickling "
1685 "a datetime object. "
1686 "pickle.load(data, encoding='latin1') is assumed.")
1687 self = object.__new__(cls)
1688 self.__setstate(year, month)
1689 self._hashcode = -1
1690 return self
1691 year, month, day = _check_date_fields(year, month, day)
1692 hour, minute, second, microsecond, fold = _check_time_fields(
1693 hour, minute, second, microsecond, fold)
1694 _check_tzinfo_arg(tzinfo)
1695 self = object.__new__(cls)
1696 self._year = year
1697 self._month = month
1698 self._day = day
1699 self._hour = hour
1700 self._minute = minute
1701 self._second = second
1702 self._microsecond = microsecond
1703 self._tzinfo = tzinfo
1704 self._hashcode = -1
1705 self._fold = fold
1706 return self
1707
1708 # Read-only field accessors
1709 @property
1710 def hour(self):
1711 """hour (0-23)"""
1712 return self._hour
1713
1714 @property
1715 def minute(self):
1716 """minute (0-59)"""
1717 return self._minute
1718
1719 @property
1720 def second(self):
1721 """second (0-59)"""
1722 return self._second

Callers 11

Time2InternaldateFunction · 0.90
_zoneinfo.pyFile · 0.90
client.pyFile · 0.90
match_to_datetimeFunction · 0.90
match_to_datetimeFunction · 0.90
update_headersMethod · 0.90
match_to_datetimeFunction · 0.90
_mktimeMethod · 0.85
localMethod · 0.85
_local_timezoneMethod · 0.85
datetime.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected