Coerces vectors to floored Date vectors.
Usage
dtt_date(x, ...)
dtt_date(x) <- value
# S3 method for class 'integer'
dtt_date(x, origin = as.Date("1970-01-01"), ...)
# S3 method for class 'double'
dtt_date(x, origin = as.Date("1970-01-01"), ...)
# S3 method for class 'character'
dtt_date(x, ...)
# S3 method for class 'Date'
dtt_date(x, ...)
# S3 method for class 'POSIXct'
dtt_date(x, ...)
# S3 method for class 'hms'
dtt_date(x, ...)
# S3 method for class 'Date'
dtt_date(x) <- value
# S3 method for class 'POSIXct'
dtt_date(x) <- value
dtt_set_date(x, value)
Methods (by class)
dtt_date(integer)
: Coerce integer vector to a floored Date vectordtt_date(double)
: Coerce double vector to a floored Date vectordtt_date(character)
: Coerce character vector to a floored Date vectordtt_date(Date)
: Coerce Date vector to a floored Date vectordtt_date(POSIXct)
: Coerce POSIXct vector to a floored Date vectordtt_date(hms)
: Coerce hms vector to a floored Date vector
Functions
dtt_date(Date) <- value
: Set date values for a Date vectordtt_date(POSIXct) <- value
: Set date values for a POSIXct vector
See also
Other floor:
dtt_date_time()
,
dtt_excel_to_date()
,
dtt_floor()
,
dtt_floored()
,
dtt_set_time()
Examples
dtt_date(1L)
#> [1] "1970-01-02"
dtt_date(-1)
#> [1] "1969-12-31"
dtt_date("2000-01-01")
#> [1] "2000-01-01"
as.Date(as.POSIXct("2019-05-01", tz = "Etc/GMT-8"))
#> [1] "2019-04-30"
dtt_date(as.POSIXct("2019-05-01", tz = "Etc/GMT-8"))
#> [1] "2019-05-01"
dtt_date(hms::as_hms("23:59:59"))
#> [1] "1970-01-01"
dtt_date(hms::as_hms("24:00:00"))
#> [1] "1970-01-02"