Ops.Date
Ops Group Method for Date/Time Objects

Description

The group method defining mathematical operations on date/time objects.

Usage

## Date
Date Compare Date   -> logical
+ Date              -> Date
Date - Date         -> difftime
Date + numeric      -> Date
Date - numeric      -> Date
Date + difftime     -> Date
Date - difftime     -> Date
numeric + Date      -> Date
difftime + Date     -> Date

## POSIXt POSIXt Compare POSIXt -> logical + POSIXt -> POSIXt POSIXt - POSIXt -> difftime POSIXt + numeric -> POSIXt POSIXt - numeric -> POSIXt POSIXt + difftime -> POSIXt POSIXt - difftime -> POSIXt numeric + POSIXt -> POSIXt difftime + POSIXt -> POSIXt

## difftime difftime Compare difftime -> logical + difftime -> difftime - difftime -> difftime difftime + difftime -> difftime difftime - difftime -> difftime difftime + numeric -> difftime difftime - numeric -> difftime numeric + difftime -> difftime numeric - difftime -> difftime difftime * numeric -> difftime difftime / numeric -> difftime numeric * difftime -> difftime

Arguments

Date a Date object.
POSIXt a POSIXt object.
difftime a difftime object.
numeric a numeric object.
logical a logical object.
Compare a logic operator including "<", ">", "!=", "==", "<=" and ">=".

Details

Value
an object as described in the usage section.
See Also
Date, POSIXt, difftime, Ops
Examples
## Date
as.Date("2038-01-19") > as.Date("1970-01-01")
as.Date("2038-01-19") - as.Date("1970-01-01")
as.Date("1970-01-01") + (as.Date("2038-01-19") - as.Date("1970-01-01"))
as.Date("1970-01-01") + 1
as.Date("1970-01-01") + as.difftime(1, units = "weeks")

## POSIXt as.POSIXct("2038-01-19 03:14:07") > as.POSIXct("1970-01-01 00:00:00") as.POSIXct("2038-01-19 03:14:07") - as.POSIXct("1970-01-01 00:00:00") as.POSIXct("1970-01-01 00:00:00") + (2^31 - 1) as.POSIXct("1970-01-01 00:00:00") + 1 as.POSIXct("1970-01-01 00:00:00") + as.difftime(1, units = "weeks")

## difftime (df1 <- as.difftime(12, units = "hours")) (df2 <- as.difftime(1, units = "days")) df1 * 2 == df2 df1 + 12 df2 / 2

Package base version 6.1.1-7
Package Index