Software
hms

hms

A simple class for storing time-of-day values

R

The hms package provides a simple class for storing and displaying time-of-day values or durations in the hh:mm:ss format. It’s designed to simplify data exchange with databases, spreadsheets, and other data sources that use time values.

The package stores times internally as seconds since midnight and supports construction from explicit hour, minute, or second values. It handles edge cases like times exceeding 24 hours or negative durations, and displays fractional seconds up to microseconds by default. The class is built on R’s difftime class and works seamlessly as a data frame column, with easy coercion to and from other time formats like POSIXt.

Contributors