.difftime(xx, units) # generally for internal use difftime(time1, time2, tz, units = c("auto", "secs", "mins", "hours", "days", "weeks"))## S3 method for class 'difftime': print(x, digits = getOption("digits"), ...) ## S3 method for class 'difftime': [(x, ..., drop = TRUE)
xx | an S object. |
time1, time2 | an S object that is inherited from or can be converted to POSIXt, such as POSIXct or POSIXlt objects or date-time strings. |
tz | a character string representing the time zone, such as "GMT". |
units | a character string from "auto", "secs", "mins", "hours", "days", and "weeks". |
format | a character string representing the time format for tim. |
x | a difftime object. |
digits | the maximum number of (significant) digits to print. |
drop | a logical flag passed to operator [. |
... | additional arguments. |
.difftime | returns a difftime object with specified units. |
difftime | returns a difftime object, representing the time difference between time1 and time2. |
print.difftime | returns the original object x, with the invisible flag set to prevent reprinting. |
[.difftime | returns a difftime object formed by extracting the relevant subset. |
## show the internal representation of the difftime class dput(.difftime(24, units = "hours"))## construct difftime objects difftime(time1 = .POSIXct(0), time2 = "1970-01-01 00:00:00") difftime(time1 = .POSIXct(0), time2 = "1970-01-01 00:00:00", tz = "UTC") difftime("2038-01-19 03:14:07", "1970-01-01 00:00:00", units = "secs") # compare with 2^31 - 1 (the Unix Millennium Bug)
## subset difftime objects (x <- as.difftime(c("0:0:1", "0:1:0", "1:0:0"))) x[2:3]