Learn R Programming

cwhmisc (version 6.0)

dt2str: Convert time difference to string.

Description

Convert time difference in seconds to string depending on switch.

Usage

dt2str(dt,dec=0,verbose=FALSE)

Arguments

dt
Time difference in seconds
dec
Places in decimal fraction of seconds
verbose
If TRUE, then delimited by "hours minutes seconds", else by ":"

Value

String representing the time difference, with dec decimals in seconds.

Examples

Run this code
  t1 <- unclass(Sys.time())
  x <- 0;  for (i in 1:1.e6) x <- x+1
  t2 <- unclass(Sys.time())
  dt2str(t2-t1,3) # 00:00:2.835

Run the code above in your browser using DataLab