round.POSIXt              package:base              R Documentation

_R_o_u_n_d / _T_r_u_n_c_a_t_e _D_a_t_a-_T_i_m_e _O_b_j_e_c_t_s

_D_e_s_c_r_i_p_t_i_o_n:

     Round or truncate date-time objects.

_U_s_a_g_e:

     ## 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, ...)

_A_r_g_u_m_e_n_t_s:

       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' for 'round'.

_D_e_t_a_i_l_s:

     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.

_V_a_l_u_e:

     An object of class '"POSIXlt"' or '"Date"'.

_S_e_e _A_l_s_o:

     'round' for the generic function and default methods.

     'DateTimeClasses', 'Date'

_E_x_a_m_p_l_e_s:

     round(.leap.seconds + 1000, "hour")
     trunc(Sys.time(), "day")

