fromordinal()

fromordinal : Return date by using Proleptic Gregorian ordinal .

About ordinal by using toordinal()

Today's fromordinal vlaue

from  datetime import date
my_ordinal=date.today().toordinal()
print("Today toordinal value : ",my_ordinal)
print("Today date :",date.fromordinal(my_ordinal))
Output
Today toordinal value :  737319
Today date : 2019-09-17
Using today and tomorrow ordinal vlaue
from datetime import date,datetime,timedelta
from datetime import date
my_today=date.today().toordinal()
print("Today toordinal output : ",my_today)
my_tomorrow=date.today() + timedelta(days=1)
my_tomorrow=my_tomorrow.toordinal()
print("Tomorrow toordinal output : ",my_tomorrow)

print(date.fromordinal(my_today))
print(date.fromordinal(my_tomorrow))
Output
Today toordinal :  737319
Tomorrow toordinal :  737320
2019-09-17
2019-09-18
All Date Objects
Your Rating




Post your comments , suggestion , error , requirements etc here




We use cookies to improve your browsing experience. . Learn more
HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
©2000-2019 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer