Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

hms

Hours, Minutes and Seconds from a Time Index or Jul


Description

Extract the fractional part of a ti (time index) or jul (julian date) object as a normalized list of hours, minutes, and seconds.

Usage

hms(x)

Arguments

x

a jul or something numeric that can be converted into a jul with a fractional part.

Details

The fractional part of x is multiplied by 86400 (the number of seconds in a day) and rounded to get the number of seconds. This is then divided by 3600 to get the number of hours, and the remainder of that is divided by 60 to get the normalized number of minutes. The remainder from the second division is the normalized number of seconds.

Value

A list with components:

hours

Normalized number of hours

minutes

Normalized number of minutes

seconds

Normalized number of seconds

See the details.

Note

Support for fractional days in ti and jul objects is relatively new and untested. There is probably code lurking about that assumes the numeric parts of ti and jul objects are integers, or even code that may round them to make sure they are integers. The fractional parts of ti and jul objects may not survive encounters with such code.

See Also

ti and jul. Also see hourly for information on intraday frequencies

Examples

hms(today() + 0.5)
hms(today())
hms(today() + 43201/86400)

tis

Time Indexes and Time Indexed Series

v1.38
Unlimited
Authors
Jeff Hallman <jeffhallman@gmail.com>
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.