Uses incoming parameters to return a pair of POSIXct
times in the
proper order. The first returned time will be midnight of the desired
starting date. The second returned time will represent the "end of the day"
of the requested or calculated enddate
boundary.
Note that the returned end date will be one unit
prior to the start
of the requested enddate
unless ceilingEnd = TRUE
in
which case the entire enddate
will be included up to the last
unit
.
The ceilingEnd
argument addresses the ambiguity of a phrase like:
"August 1-8". With ceilingEnd = FALSE
(default) this pharse means
"through the beginning of Aug 8". With ceilingEnd = TRUE
it means
"through the end of Aug 8".
So, to get 24 hours of data staring on Jan 01, 2019 you would specify:
> MazamaCoreUtils::dateRange(20190101, 20190102, timezone = "UTC")
[1] "2019-01-01 00:00:00 UTC" "2019-01-01 23:59:59 UTC"
or
> MazamaCoreUtils::dateRange(20190101, 20190101,
timezone = "UTC", ceilingEnd = TRUE)
[1] "2019-01-01 00:00:00 UTC" "2019-01-01 23:59:59 UTC"
The required timezone
parameter must be one of those found in
OlsonNames
.
Dates can be anything that is understood by
lubrdiate::parse_date_time()
using the Ymd[HMS]
orders. This
includes:
"YYYYmmdd"
"YYYYmmddHHMMSS"
"YYYY-mm-dd"
"YYYY-mm-dd H"
"YYYY-mm-dd H:M"
"YYYY-mm-dd H:M:S"