6.3.90.900
10 Generic Moment Operations
value
gen:moment-provider : any/c
An interface, implemented by moment, that supplies generic
operations on moments.
procedure
(moment-provider? x) → boolean?
x : any/c
procedure
t : moment-provider?
Returns the moment corresponding to t.
procedure
(->utc-offset t) → (integer-in -64800 64800)
t : moment-provider?
Returns the UTC offset of t in seconds.
Examples:
> (->utc-offset (moment 1970 #:tz "Etc/UTC")) 0
> (->utc-offset (moment 1970 1 1 #:tz "America/New_York")) -18000
> (->utc-offset (moment 1970 6 1 #:tz "America/New_York")) -14400
> (->utc-offset (moment 1970 6 1 #:tz -18000)) -18000
procedure
(->timezone t) → tz/c
t : moment-provider?
Returns the time zone component of t, whether it is an IANA ID
or a UTC offset.
Examples:
> (->timezone (moment 1970 #:tz "Etc/UTC")) "Etc/UTC"
> (->timezone (moment 1970 1 1 #:tz "America/New_York")) "America/New_York"
> (->timezone (moment 1970 6 1 #:tz -18000)) -18000
procedure
t : moment-provider?
Returns the time zone component of t only if it is an IANA ID. If it is
a UTC offset, #f is returned.
Examples:
procedure
(adjust-timezone t tz) → moment-provider?
t : moment-provider? tz : tz/c
Returns a moment provider m, such that:
(and (moment=? t (->moment m)) (equal? tz (->timezone m))).
Examples:
> (adjust-timezone (moment 1970 #:tz "Etc/UTC") "Antarctica/Troll") #<moment 1970-01-01T00:00:00Z[Antarctica/Troll]>
> (adjust-timezone (moment 1970 6 1 0 0 0 #:tz "Europe/Paris") -18000) #<moment 1970-05-31T18:00:00-05:00>