On this page:
gen:  datetime-arithmetic-provider
datetime-arithmetic-provider?
+  period
-period
8.12

13 Datetime Arithmetic🔗ℹ

An interface that defines datetime arithmetic operations. It is implemented by all objects that satisfy datetime?, moment?, or period?.

procedure

(datetime-arithmetic-provider? x)  boolean

  x : any/c
Returns #t if x implements gen:datetime-arithmetic-provider; #f otherwise.

Adds or subtracts p to/from dt, returning a fresh datetime arithmetic provider the same type as dt.

Examples:
> (+period (datetime 1970) (period [years 5] [hours 2]))

#<datetime 1975-01-01T02:00:00>

> (-period (moment 2015 3 8 3 #:tz "America/New_York") (hours 2))

#<moment 2015-03-08T00:00:00-05:00[America/New_York]>

> (+period (years 10) (years -5))

#<period of 5 years>