from datetime import datetime x = datetime.now() x.toordinal()
Here is what the above code is Doing:
1. We created a datetime object, x, and assigned it to the current time.
2. We called the toordinal() method on x.
3. This returns the ordinal of the date, which is the number of days since January 1st, 1 AD.