dttm_diff: Difference between two dates

View source: R/dttm_diff.r

dttm_diffR Documentation

Difference between two dates

Description

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")

vbfelix/relper documentation built on May 10, 2024, 10:50 p.m.