time-index-properties: Time Index Properties (Leap Years, Period Lengths, DST)

time-index-propertiesR Documentation

Time Index Properties (Leap Years, Period Lengths, DST)

Description

The following functions can be used to determine whether years are leap years, compute the number of subperiods within a period, and determine whether Daylight Saving Time is on for particular date-time index. All function are vectorised.

is.leap_year returns TRUE for leap years and FALSE for non-leap ones.

days_in_year and weeks_in_year return the number of days (365–366) and the number of weeks (52–53) in a year.

days_in_quarter and days_in_month return the number of days in a quarter (90–92) or a month (28–31), respectively.

hours_in_day returns the number of hours in a day (24 most of the time, a different number during DST/UTC offset changes).

is.dst returns TRUE when Daylight Saving Time is on and FALSE otherwise.

Usage

is.leap_year(x)

days_in_year(x)

weeks_in_year(x)

days_in_quarter(x)

days_in_month(x)

hours_in_day(x, tz = NULL)

is.dst(x)

Arguments

x

an object of tind class or an R object coercible to it.

tz

(optional) a character value determining the time zone (the default NULL is interpreted as the system time zone). See tzone documentation for information on time zones.

Value

is.leap_year and is.dst return logical vectors. The remaining functions return integer vectors, except for hours_in_day, which returns numeric vectors.

See Also

time-index-components, calendrical-computations, Ops, tzone, bizdays_in_month.


tind documentation built on Dec. 28, 2025, 1:06 a.m.