
new_period(...)
Periods track the change in the "clock time" between two date-times. They are measured in common time related units: years, months, days, hours, minutes, and seconds. Each unit except for seconds must be expressed in integer values.
Period objects can be easily created with the helper
functions years
, months
,
weeks
, days
,
minutes
, seconds
. These
objects can be added to and subtracted to date-times to
create a user interface similar to object oriented
programming.
period
, as.period
new_period (second = 90, minute = 5)
# 5 minutes and 90 seconds
new_period(day = -1)
# -1 days
new_period(second = 3, minute = 1, hour = 2, day = 6, week = 1)
# 13 days, 2 hours, 1 minute and 3 seconds
new_period(hour = 1, minute = -60)
# 1 hour and -60 minutes
new_period(second = 0)
# 0 seconds}
Run the code above in your browser using DataLab