tod: Retrieve time of day in '%H:%M:%S' or '%H:%M:00' format

View source: R/tod.R

todR Documentation

Retrieve time of day in %H:%M:%S or %H:%M:00 format

Description

Retrieve time of day in %H:%M:%S or %H:%M:00 format

Usage

tod(x, ...)

## Default S3 method:
tod(x, rational = attr(x, "rational"), ...)

## S3 method for class 'daytime'
tod(x, rational = attr(x, "rational"), ...)

Arguments

x

a daytime or POSIXt object, or an object that can be cast to daytime

...

arguments passed to as_daytime.

rational

logical. Return partial minutes as a numeric %S value? The default (rational = FALSE) will return %H:%M:00 format.

Details

For objects that do not inherit from daytime or POSIXt, the default method is a chain of casts, first to daytime and then to character.

Value

character value(s) in the desired format

Examples

x <- Sys.time()

tod(x, FALSE)
tod(x, TRUE)

tod(0, FALSE)
tod(720, FALSE)
tod(1439.999, TRUE)

paulhibbing/daytime documentation built on July 13, 2022, 6:32 p.m.