Interval class

Interval is an S4 class that extends the Timespan-class class. An Interval object records one or more spans of time. Intervals record these timespans as a sequence of seconds that begin at a specified date. Since intervals are anchored to a precise moment of time, they can accurately be converted to Period-class or Duration-class class objects. This is because we can observe the length in seconds of each period that begins on a specific date. Contrast this to a generalized period, which may not have a consistent length in seconds (e.g. the number of seconds in a year will change if it is a leap year).


Intervals can be both negative and positive. Negative intervals progress backwards from the start date; positive intervals progress forwards.

Interval class objects have two slots: .Data, a numeric object equal to the number of seconds in the interval; and start, a POSIXct object that specifies the time when the interval starts.

  • $,Interval-method
  • $<-,Interval-method
  • *,ANY,Interval-method
  • *,Interval,ANY-method
  • +,Date,Interval-method
  • +,Interval,Date-method
  • +,Interval,Duration-method
  • +,Interval,Interval-method
  • +,Interval,POSIXct-method
  • +,Interval,POSIXlt-method
  • +,Interval,Period-method
  • +,Interval,difftime-method
  • +,Interval,numeric-method
  • +,POSIXct,Interval-method
  • +,POSIXlt,Interval-method
  • +,difftime,Interval-method
  • +,numeric,Interval-method
  • -,Date,Interval-method
  • -,Duration,Interval-method
  • -,Interval,Date-method
  • -,Interval,Interval-method
  • -,Interval,POSIXct-method
  • -,Interval,POSIXlt-method
  • -,Interval,missing-method
  • -,Interval,numeric-method
  • -,POSIXct,Interval-method
  • -,POSIXlt,Interval-method
  • -,Period,Interval-method
  • -,numeric,Interval-method
  • /,Interval,Duration-method
  • /,Interval,Interval-method
  • /,Interval,Period-method
  • /,Interval,difftime-method
  • /,Interval,numeric-method
  • /,difftime,Interval-method
  • /,numeric,Interval-method
  • Interval-class
  • [,Interval-method
  • [<-,Interval,ANY,ANY,ANY-method
  • %%,Interval,Duration-method
  • %%,Interval,Interval-method
  • %%,Interval,Period-method
  • as.difftime,Interval-method
  • as.numeric,Interval-method
  • c,Interval-method
  • intersect,Interval,Interval-method
  • rep,Interval-method
  • setdiff,Interval,Interval-method
  • show,Interval-method
  • union,Interval,Interval-method
Documentation reproduced from package lubridate, version 1.2.0, License: GPL

Community examples

Looks like there are no examples yet.