subtract_dates

0th

Percentile

Subtraction for the duration (i...

Subtraction for the duration (i.e, difftime), period, and interval classes.

Keywords
methods, arith, chron
Usage
subtract_dates(e1, e2)
Arguments
e1
a duration(i.e. difftime), period, interval, POSIXt, or Date object
e2
a duration(i.e. difftime), period, interval, POSIXt, or Date object
Details

The subtraction methods returns an interval object when a POSIXt or Date object is subtracted from another POSIXt or Date object. To retrieve this difference as a difftime, use as.duration. To retrieve it as a period use as.period.

Since a specific number of seconds exists between two dates, the duration returned will not include unspecific time units such as years and months. See duration for more details.

Value

  • a new duration(i.e. difftime), period, interval, POSIXt, or Date object, depending on e1 and e2

Aliases
  • -.period
  • -.POSIXt
  • -.difftime
  • -.Date
  • -.interval
  • subtract_dates
Examples
x <- new_duration(day = 1)
now() - x
-x
x - x
as.Date("2009-08-02") - as.Date("2008-11-25")
Documentation reproduced from package lubridate, version 0.1, License: GPL

Community examples

Looks like there are no examples yet.