Python Arrow Module: Get the proleptic Gregorian ordinal of a given date
Write a Python program to get the proleptic Gregorian ordinal of a given date.
Sample Solution:
Python Code:
import arrow
a = arrow.utcnow()
print("Current datetime:")
print(a)
print("\nProleptic Gregorian ordinal of the date:")
print(arrow.utcnow().toordinal())
Sample Output:
Current datetime: 2019-06-04T07:02:32.671600+00:00 Proleptic Gregorian ordinal of the date: 737214
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to create a time object with the same hour, minute, second, microsecond and timezone info.
Next: Write a Python program to get string representing the date, controlled by an explicit format string.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics