Learn R Programming

quantdates (version 1.0)

difftime_leap_year: difftime_leap_year

Description

Function to count the number of days between two dates. Optional parameters to count without the leap-days.

Usage

difftime_leap_year(tfinal, tinitial, leapDatesIn = TRUE)

Value

Number of days between the specified dates.

Arguments

tfinal

Final date.

tinitial

Initial date.

leapDatesIn

If TRUE count leap Dates, else exclude from counting.

Author

Julian Chitiva and Diego Jara

Examples

Run this code
#Function accepts Dates as Dates or as characters.
difftime_leap_year(tfinal='2023-03-05',tinitial='2019-02-28',leapDatesIn=TRUE)
difftime_leap_year(tfinal=as.Date('2023-03-05'),tinitial=as.Date('2019-02-28'),leapDatesIn=TRUE)
difftime_leap_year(tfinal='2023-03-05',tinitial='2019-02-28',leapDatesIn=FALSE)
difftime_leap_year(tfinal='2023-03-05',tinitial=as.Date('2019-02-28'),leapDatesIn=FALSE)

Run the code above in your browser using DataLab