round.POSIXt {base} | R Documentation |
Round or truncate date-time objects.
## S3 method for class 'POSIXt': round(x, units=c("secs", "mins", "hours", "days")) ## S3 method for class 'POSIXt': trunc(x, units=c("secs", "mins", "hours", "days")) ## S3 method for class 'Date': round(x, ...) ## S3 method for class 'Date': trunc(x)
x |
an object inheriting from "POSIXt" or "Date" . |
units |
one of the units listed. Can be abbreviated. |
... |
arguments to be passed to or from other methods, notably
digits . |
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.
The methods for class "Date"
are of little use except to remove
fractional days.
An object of class "POSIXlt"
.
round
for the generic function and default methods.
round(.leap.seconds + 1000, "hour") trunc(Sys.time(), "day")