datey_components: Get year, month, day or day_fraction breakdown of a 'datey'

datey_componentsR Documentation

Get year, month, day or day_fraction breakdown of a datey

Description

To extract the year, month, day or day_fraction breakdown of a datey, use either

  • the list-like syntax ⁠$year⁠, ⁠$month⁠, ⁠$day⁠ or ⁠$day_fraction⁠ direct, or

  • if you need several components at once, to_ymdf(), which returns an actual list of year, month, day and day_fraction.

In this breakdown,

  • year is an integer in [1000,3000],

  • month is an integer in [1,12],

  • day is an integer in [1,N], where N is the number of days in the month specified by year and month, and

  • day_fraction is a double in [0,1) representing the fraction of the day, where e.g. 0 means the start and 0.5 means the middle of the day.

If the datey was constructed using end_day or day_fraction = 1 then to_ymdf() will return the start of the next day with day_fraction = 0.

Usage

to_ymdf(x)

## S3 method for class 'datey'
x$name

Arguments

x

The datey to be deconstructed.

name

The name of the component for the list-like syntax. Must be year, month, day or day_fraction.

Value

to_ymdf() returns a list of integer vector year, integer vector month, integer vector day, and double vector day_fraction, all with the same length. The list-like syntax returns these components individually.

See Also

datey, text_from_datey

Examples

  t <- datey(2001, 2, 3, 0.5)
  t
  to_ymdf(t)
  t$year
  t$month
  t$day
  t$day_fraction

datey documentation built on July 14, 2026, 5:06 p.m.