round.POSIXt {base} | R Documentation |
Round or truncate date-time objects.
round(x, units=c("secs", "mins", "hours", "days")) trunc(x, units=c("secs", "mins", "hours", "days"))
x |
an object inheriting from "POSIXt" . |
units |
one of the units listed. Can be abbreviated. |
The time is rounded or truncated to the second, minute, hour or day. Timezones are only relevant to days, when midnight in the current timezone is used.
An object of class "POSIXlt"
.
round(.leap.seconds + 1000, "hour") trunc.POSIXt(Sys.time(), "day")