subtract_dates
From lubridate v0.1
by Hadley Wickham
Subtraction for the duration (i...
Subtraction for the duration (i.e, difftime), period, and interval classes.
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
Examples
x <- new_duration(day = 1)
now() - x
-x
x - x
as.Date("2009-08-02") - as.Date("2008-11-25")
Community examples
Looks like there are no examples yet.