Chronology
Chronology is a Python library for dealing with time (and date).
Installation
pip install chronology
get_number_of_days
It returns the number of days in a month or a year. If month is not given, the function returns the number of days in a year.
from chronology import get_number_of_days
get_number_of_days(year=2020)
366
from chronology import get_number_of_days
get_number_of_days(year=2020, month=2)
29
get_elapsed
The get_elapsed method measures the elapsed time from start to end in one of the following units: seconds, minutes, hours, days, months, or years.
from chronology import get_elapsed
from datetime import datetime
start_time = datetime.strptime('Mar 6 2019 1:33AM', '%b %d %Y %I:%M%p')
end_time = datetime.strptime('Mar 8 2019 1:32AM', '%b %d %Y %I:%M%p')
get_elapsed(start=start_time, end=end_time)
datetime.timedelta(1, 86340)
get_elapsed(start=start_time, end=end_time, unit='seconds')
172740.0
get_elapsed(start=start_time, end=end_time, unit='hours')
47.983333333333334