Infer a time interval from a character string in the form MM:SS or HH:MM:SS.

ctimeToSeconds(ctime)

Arguments

ctime

a character string (see “Details”.

Value

A numeric value, the number of seconds represented by the string.

See also

See secondsToCtime(), the inverse of this.

Other things related to time: julianCenturyAnomaly(), julianDay(), numberAsHMS(), numberAsPOSIXct(), secondsToCtime(), unabbreviateYear()

Author

Dan Kelley

Examples

library(oce)
cat("10      = ", ctimeToSeconds("10"), "s\n", sep = "")
#> 10      = 10s
cat("01:04   = ", ctimeToSeconds("01:04"), "s\n", sep = "")
#> 01:04   = 64s
cat("1:00:00 = ", ctimeToSeconds("1:00:00"), "s\n", sep = "")
#> 1:00:00 = 3600s