\HeaderA{round.POSIXt}{Round / Truncate Data-Time Objects}{round.POSIXt}
\aliasA{round.Date}{round.POSIXt}{round.Date}
\aliasA{trunc.Date}{round.POSIXt}{trunc.Date}
\aliasA{trunc.POSIXt}{round.POSIXt}{trunc.POSIXt}
\keyword{chron}{round.POSIXt}
\begin{Description}\relax
Round or truncate date-time objects.
\end{Description}
\begin{Usage}
\begin{verbatim}
## 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, ...)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{x}] an object inheriting from \code{"POSIXt"} or \code{"Date"}.
\item[\code{units}] one of the units listed.  Can be abbreviated.
\item[\code{...}] arguments to be passed to or from other methods, notably
\code{digits} for \code{round}.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
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 \code{"Date"} are of little use except to remove
fractional days.
\end{Details}
\begin{Value}
An object of class \code{"POSIXlt"} or \code{"Date"}.
\end{Value}
\begin{SeeAlso}\relax
\code{\LinkA{round}{round}} for the generic function and default methods.

\code{\LinkA{DateTimeClasses}{DateTimeClasses}}, \code{\LinkA{Date}{Date}}
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
round(.leap.seconds + 1000, "hour")
trunc(Sys.time(), "day")
\end{ExampleCode}
\end{Examples}

