difftimeFmt {ODB} | R Documentation |
Formats a time difference in multiple units
Description
This function converts a time difference (in seconds) into a string with various time units (days, hours, minutes, seconds and milliseconds).
Usage
difftimeFmt(x)
Arguments
x |
Time difference to format (single value). Can be a floating number of seconds, or a |
Value
Returns a character of length 1, according to the following format : "[d]d [h]:[m]:[s].[ms]". Days and milliseconds are omitted if they can be.
Author(s)
Sylvain Mareschal
Examples
# Full format
difftimeFmt(94521.125846)
# With dates
T1 <- strptime("2011-03-21 14:32:03", format="%Y-%m-%d %H:%M:%S")
T2 <- strptime("2011-08-06 18:14:21", format="%Y-%m-%d %H:%M:%S")
dT <- as.double(difftime(T2, T1, units="secs"))
difftimeFmt(dT)
[Package ODB version 1.2.1 Index]