What is the inverse of date.toordinal() in python? -
in python, date
object can converted in proleptic gregorian ordinal way:
d=datetime.date(year=2010, month=3, day=1) d.toordinal()
but reverse operation?
the opposite date.fromordinal
classmethod date.fromordinal(ordinal)
return date corresponding proleptic gregorian ordinal, january 1 of year 1 has ordinal 1. valueerror raised unless 1 <= ordinal <= date.max.toordinal(). date d, date.fromordinal(d.toordinal()) == d.
Comments
Post a Comment