Skip to contents

Computation of the difference between two dates (date2 - date1 + add).

Usage

dttm_diff(
  date1,
  date2,
  add = 0,
  unit = c("days", "secs", "mins", "hours", "weeks")
)

Arguments

date1

A date single value

date2

A date single value

add

A numeric single value (default = 0)

unit

A character single value with the unit of the date result (secs, mins, hours, days, weeks)

Value

A numeric single value with the computed difference between the two dates.

Examples


date1 <- lubridate::dmy("01/05/1998")

date2 <- lubridate::dmy("21/11/2018")

dttm_diff(date1 = date1,date2 = date2,unit = "days")
#> [1] 7509