Path: blob/master/Datetime/Datetime_Convert_relative_time_delta_to_months.ipynb
3514 views
Kernel: Python 3

Datetime - Convert relative time delta to months
Tags: #datetime #relativedelta #calculate #date #time #dateutil
Author: Florent Ravenel
Last update: 2023-07-05 (Created: 2023-05-22)
Description: This notebook is designed to convert the relative time delta between two dates into months. By utilizing the relativedelta function, the conversion becomes more accurate compared to using timedelta, as relativedelta considers the varying number of days in each month.
References:
Input
Import libraries
In [ ]:
Setup Variables
start_date: First dateend_date: Second date
In [ ]:
Model
Calculate delta and convert to months
Calculate the time delta between two dates using the relativedelta function from the dateutil library.
In [ ]:
Output
Display result
In [ ]: