Gets and sets hour values for date/time vectors.
Usage
dtt_hours(x, ...)
dtt_hours(x) <- value
dtt_hour(x, ...)
dtt_hour(x) <- value
# S3 method for class 'Date'
dtt_hour(x, ...)
# S3 method for class 'POSIXct'
dtt_hour(x, ...)
# S3 method for class 'hms'
dtt_hour(x, ...)
# S3 method for class 'POSIXct'
dtt_hour(x) <- value
# S3 method for class 'hms'
dtt_hour(x) <- value
dtt_set_hour(x, value)
Methods (by class)
dtt_hour(Date)
: Get integer vector of hour values for a Date vectordtt_hour(POSIXct)
: Get integer vector of hour values for a POSIXct vectordtt_hour(hms)
: Get integer vector of hour values for a hms vector
Functions
dtt_hour(POSIXct) <- value
: Set hour values for a POSIXct vectordtt_hour(hms) <- value
: Set hour values for a hms vector
See also
Other set time:
dtt_minutes()
,
dtt_seconds()
Examples
x <- as.POSIXct("1990-01-02 23:40:51")
dtt_hour(x)
#> [1] 23
dtt_hour(x) <- 01L
x
#> [1] "1990-01-02 01:40:51 UTC"
x <- hms::as_hms("23:40:51")
dtt_hour(x)
#> [1] 23
dtt_hour(x) <- 01L
x
#> 01:40:51