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

Function _ymd2ord

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

year, month, day -> ordinal, considering 01-Jan-0001 as day 1.

(year, month, day)

Source from the content-addressed store, hash-verified

61 return _DAYS_BEFORE_MONTH[month] + (month > 2 and _is_leap(year))
62
63def _ymd2ord(year, month, day):
64 "year, month, day -> ordinal, considering 01-Jan-0001 as day 1."
65 assert 1 <= month <= 12, 'month must be in 1..12'
66 dim = _days_in_month(year, month)
67 assert 1 <= day <= dim, ('day must be in 1..%d' % dim)
68 return (_days_before_year(year) +
69 _days_before_month(year, month) +
70 day)
71
72_DI400Y = _days_before_year(401) # number of days in 400 years
73_DI100Y = _days_before_year(101) # " " " " 100 "

Callers 6

_build_struct_timeFunction · 0.85
_isoweek_to_gregorianFunction · 0.85
toordinalMethod · 0.85
isocalendarMethod · 0.85
__hash__Method · 0.85
_isoweek1mondayFunction · 0.85

Calls 3

_days_in_monthFunction · 0.85
_days_before_yearFunction · 0.85
_days_before_monthFunction · 0.85

Tested by

no test coverage detected