What is the inverse of date.toordinal() in python? -


in python, dateobject 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

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -