MCPcopy Index your code
hub / github.com/python/cpython / fromordinal

Method fromordinal

Lib/_pydatetime.py:1039–1046  ·  view source on GitHub ↗

Construct a date from a proleptic Gregorian ordinal. January 1 of year 1 is day 1. Only the year, month and day are non-zero in the result.

(cls, n)

Source from the content-addressed store, hash-verified

1037
1038 @classmethod
1039 def fromordinal(cls, n):
1040 """Construct a date from a proleptic Gregorian ordinal.
1041
1042 January 1 of year 1 is day 1. Only the year, month and day are
1043 non-zero in the result.
1044 """
1045 y, m, d = _ord2ymd(n)
1046 return cls(y, m, d)
1047
1048 @classmethod
1049 def fromisoformat(cls, date_string):

Callers 5

_strptimeFunction · 0.80
__add__Method · 0.80
__add__Method · 0.80
test_extreme_ordinalsMethod · 0.80

Calls 2

_ord2ymdFunction · 0.85
clsClass · 0.50

Tested by 2

test_extreme_ordinalsMethod · 0.64