timeRange | R Documentation |
Uses incoming parameters to return a pair of POSIXct
times in the
proper order. Both start and end times will have lubridate::floor_date()
applied to get the nearest unit
. This can be modified by specifying
ceilingStart = TRUE
or ceilingEnd = TRUE
in which case
lubridate::ceiling_date()
will be applied.
The required timezone
parameter must be one of those found in
OlsonNames
.
Dates can be anything that is understood by
lubrdiate::parse_date_time()
including either of the following
recommended formats:
"YYYYmmddHH[MMSS]"
"YYYY-mm-dd HH:MM:SS"
timeRange(
starttime = NULL,
endtime = NULL,
timezone = NULL,
unit = "sec",
ceilingStart = FALSE,
ceilingEnd = FALSE
)
starttime |
Desired start datetime (ISO 8601). |
endtime |
Desired end datetime (ISO 8601). |
timezone |
Olson timezone used to interpret dates (required). |
unit |
Units used to determine time at end-of-day. |
ceilingStart |
Logical instruction to apply
|
ceilingEnd |
Logical instruction to apply
|
A vector of two POSIXct
s.
When startdate
or enddate
are already POSIXct
values,
they are converted to the timezone specified by timezone
without
altering the physical instant in time the input represents. This is different
from the behavior of parse_date_time
(which powers
this function), which will force POSIXct
inputs into a new timezone,
altering the physical moment of time the input represents.
library(MazamaCoreUtils)
timeRange("2019-01-08 10:12:15", 20190109102030, timezone = "UTC")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.