HmsToSec: Convert h:m:s To/From Seconds

Description Usage Arguments Value Author(s) See Also Examples

View source: R/DescTools.r

Description

HmsToSec - Converts a vector of h:m:s to seconds.

SecToHms - Converts a vector of seconds to h:m:s.

Usage

1
2
HmsToSec(x)
SecToHms(x, digits = NULL)

Arguments

x

A vector of times in h:m:s (for HmsToSec) or seconds (for SecToHms).

digits

the number of digits to use for potential fractions of seconds.

Value

HmsToSec - Returns a vector of times in seconds.

SecToHms - Returns a vector of times in h:m:s format.

Author(s)

Tyler Rinker <tyler.rinker@gmail.com>

See Also

times

Examples

1
2
3
HmsToSec(c("02:00:03", "04:03:01"))
HmsToSec(SecToHms(c(222, 1234, 55)))
SecToHms(c(256, 3456, 56565))

Example output

[1]  7203 14581
[1]  222 1234   55
[1] "00:04:16" "00:57:36" "15:42:45"

DescTools documentation built on June 17, 2021, 5:12 p.m.