DiffPeriod: 'DiffYear'

View source: R/maths.R

DiffPeriodR Documentation

DiffYear

Description

Computes the difference in years between two dates.

Usage

DiffPeriod(from, to, by, ceiling = FALSE)

Arguments

from

The earlier date.

to

The later date.

by

The period used in the conversion. Either "Week", "month", "quarter", or "year".

ceiling

If TRUE, rounds partial-year differences up (otherwise they are rounded down). Ignores seconds, minutes, and hours.

Details

Dates of 29th of Feb are automatically converted to "2016-02-28" to deal with bugs in lubridate.

Value

An integer.

Examples

DiffPeriod("2015/05/06", "2017/05/06", by = "year")

NumbersInternational/flipTime documentation built on Feb. 26, 2024, 6:44 a.m.