date_time_build {clock} | R Documentation |
Building: date-time
Description
date_time_build()
builds a POSIXct from it's individual components.
To build a POSIXct, it is required that you specify the zone
.
Usage
date_time_build(
year,
month = 1L,
day = 1L,
hour = 0L,
minute = 0L,
second = 0L,
...,
zone,
invalid = NULL,
nonexistent = NULL,
ambiguous = NULL
)
Arguments
year |
The year. Values |
month |
The month. Values |
day |
The day of the month. Values If |
hour |
The hour. Values |
minute |
The minute. Values |
second |
The second. Values |
... |
These dots are for future extensions and must be empty. |
zone |
A valid time zone name. This argument is required, and must be specified by name. |
invalid |
One of the following invalid date resolution strategies:
Using either If If |
nonexistent |
One of the following nonexistent time resolution strategies, allowed to be either length 1, or the same length as the input:
Using either If If |
ambiguous |
One of the following ambiguous time resolution strategies, allowed to be either length 1, or the same length as the input:
Alternatively, Finally, If If |
Details
Components are recycled against each other using tidyverse recycling rules.
Value
A POSIXct.
Examples
# The zone argument is required!
# clock always requires you to be explicit about your choice of `zone`.
try(date_time_build(2020))
date_time_build(2020, zone = "America/New_York")
# Nonexistent time due to daylight saving time gap from 01:59:59 -> 03:00:00
try(date_time_build(1970, 4, 26, 1:12, 30, zone = "America/New_York"))
# Resolve with a nonexistent time resolution strategy
date_time_build(
1970, 4, 26, 1:12, 30,
zone = "America/New_York",
nonexistent = "roll-forward"
)