toordinal() Function Of Datetime.date Class In Python
The toordinal() function is used to return the proleptic Gregorian ordinal of a specified datetime instance.
Note: The Proleptic Gregorian ordinal gives the number of days elapsed from the date 01/Jan/0001. And here ordinal is called Proleptic since the Gregorian calendar itself is followed from October 1582.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Parameters: This function does not accept any parameter.
Return values: This function returns the proleptic Gregorian ordinal of a datetime instance.
Example 1: Using today’s date.
Proleptic Ordinal for today's date: 737998
Example 2: Using today’s date and time.
Proleptic Ordinal for today's date and time: 737998
Example 3: Using a specific date.
Proleptic Ordinal for today's date and time: 495858