Skip to content
Prev 79713 / 398502 Next

How to convert time to days

Those are obviously days, not seconds. A simple test would have
answered your question:
test <- strptime("20051026 15:26:19",format="%Y%m%d %H:%M:%S") -
    strptime("20051024 16:23:01",format="%Y%m%d %H:%M:%S")
class(test)
test
cat(test,"\n")

If you prefer you can use difftime for conversion:
difftime(strptime("20051026 15:26:19",format="%Y%m%d %H:%M:%S"),
    strptime("20051024 16:23:01",format="%Y%m%d %H:%M:%S"),units="hours")