DATEDIF: Basic DATEDIF function from excel

Description Usage Arguments Value Examples

View source: R/DATEDIF.R

Description

It acts similiarly to Excel's DATEDIF function. It returns difference between two dates, either day,month or year, it's up to the user to specify which type of difference user wants.

Usage

1
DATEDIF(start_date, end_date, difference = "d")

Arguments

start_date

Start date to evaluate the difference

end_date

End Date to evaluate the difference

difference

What type of difference do you want? Year,Month or Day? Specify "m" for example for month/months, "d" for day/days and "y" for year/years.

Value

In these examples we have all 3 types of returns, first is difference between specified two dates in days, second one is difference in months and third one is difference in years.Function will always return numeric class.

Examples

1
2
3
DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"d")
DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"m")
DATEDIF(DATE(2020,1,1),DATE(2020,2,1),"Y")

Example output

extract_numeric() is deprecated: please use readr::parse_number() instead
[1] 31
[1] 1
[1] 0

ExcelFunctionsR documentation built on July 1, 2020, 8:35 p.m.