Skip to contents

Floors a date/time vector

Usage

dtt_floor(x, units, ...)

# S3 method for class 'Date'
dtt_floor(x, units = "days", ...)

# S3 method for class 'POSIXct'
dtt_floor(x, units = "seconds", ...)

# S3 method for class 'hms'
dtt_floor(x, units = "seconds", ...)

Arguments

x

A date/time vector.

units

A string of the time units. The possible values are "secs", "minutes", "hours", "days" or "weeks".

...

Unused.

Value

The floored date/time vector.

Methods (by class)

  • dtt_floor(Date): Floor a Date vector

  • dtt_floor(POSIXct): Floor a POSIXct vector

  • dtt_floor(hms): Floor a hms vector

See also

Examples

dtt_floor(hms::as_hms("23:59:59"), "hours")
#> 23:00:00