difftime                package:base                R Documentation

_T_i_m_e _I_n_t_e_r_v_a_l_s

_D_e_s_c_r_i_p_t_i_o_n:

     Create, print and round time intervals.

_U_s_a_g_e:

     time1 - time2
     difftime(time1, time2, tz = "",
              units = c("auto", "secs", "mins", "hours", "days", "weeks"))
     round(x, digits = 0)

_A_r_g_u_m_e_n_t_s:

time1, time2: date-time objects.

      tz: A timezone specification to be used for the conversion.
          System-specific, but `""' is the current time zone, and
          `"GMT"' is UTC.

   units: character.  Units in which the results are desired. Can be
          abbreviated.

       x: An object inheriting from class `"difftime"'.

  digits: integer. Number of significant digits to retain.

_D_e_t_a_i_l_s:

     Function `difftime' takes a difference of two date/time objects
     (of either class) and returns an object of class `"difftime"' with
     an attribute indicating the units.  There is a `round' method for
     objects of this class.

     If `units = "auto"', a suitable set of units is chosen, the
     largest possible (excluding `"weeks"') in which all the absolute
     differences are greater than one.

     Subtraction of two date-time objects gives an object of this
     class, by calling `difftime' with `units="auto"'.

_S_e_e _A_l_s_o:

     `DateTimeClasses'.

_E_x_a_m_p_l_e_s:

     (z <- Sys.time() - 3600)
     Sys.time() - z                # just over 3600 seconds.

     ## time interval between releases of 1.2.2 and 1.2.3.
     ISOdate(2001, 4, 26) - ISOdate(2001, 2, 26)

