5 Moments
The moment struct represents the combination of a datetime and a time zone.
procedure
(moment year [ month day hour minute second nanosecond #:tz tz #:resolve-offset resolve]) → moment? year : exact-integer? month : (integer-in 1 12) = 1 day : (day-of-month/c year month) = 1 hour : (integer-in 0 23) = 0 minute : (integer-in 0 59) = 0 second : (integer-in 0 59) = 0 nanosecond : (integer-in 0 999999999) = 0 tz : tz/c = (current-timezone) resolve : offset-resolver/c = resolve-offset/raise
> (moment 1970) #<moment 1970-01-01T00:00:00-07:00[America/Denver]>
> (moment 1969 7 21 2 56 #:tz "Etc/UTC") #<moment 1969-07-21T02:56:00Z[Etc/UTC]>
> (moment 2015 3 8 2 #:tz -18000) #<moment 2015-03-08T02:00:00-05:00>
> (moment 2015 3 8 2 #:tz "America/New_York") Illegal moment: local time 2015-03-08T02:00:00 does not
exist in time zone America/New_York
> (moment 2015 3 8 2 #:tz "America/New_York" #:resolve-offset resolve-offset/pre) #<moment 2015-03-08T01:59:59.999999999-05:00[America/New_York]>
> (moment 2015 3 8 2 #:tz "America/New_York" #:resolve-offset resolve-offset/post) #<moment 2015-03-08T03:00:00-04:00[America/New_York]>
procedure
(moment->iso8601 m) → string?
m : moment?
> (moment->iso8601 (moment 1970 #:tz "Etc/UTC")) "1970-01-01T00:00:00Z"
> (moment->iso8601 (moment 1969 7 21 2 56 #:tz 0)) "1969-07-21T02:56:00Z"
> (moment->iso8601 (moment 1 2 3 4 5 6 7 #:tz "America/Los_Angeles")) "0001-02-03T04:05:06.000000007-08:00"
procedure
(moment->iso8601/tzid m) → string?
m : moment?
> (moment->iso8601/tzid (moment 1970 #:tz "Etc/UTC")) "1970-01-01T00:00:00Z[Etc/UTC]"
> (moment->iso8601/tzid (moment 1969 7 21 2 56 #:tz 0)) "1969-07-21T02:56:00Z"
> (moment->iso8601/tzid (moment 1 2 3 4 5 6 7 #:tz "America/Los_Angeles")) "0001-02-03T04:05:06.000000007-08:00[America/Los_Angeles]"
procedure
x : moment? y : moment?
procedure
x : moment? y : moment?
procedure
x : moment? y : moment?
procedure
x : moment? y : moment?
procedure
x : moment? y : moment?
> (moment=? (moment 1970 1 1) (moment 1970)) #t
> (moment=? (moment 1969 12 31 19 #:tz "America/New_York") (moment 1970 #:tz "Etc/UTC")) #t
> (equal? (moment 1969 12 31 19 #:tz "America/New_York") (moment 1970 #:tz "Etc/UTC")) #f
> (moment<? (moment 1970 #:tz "Etc/UTC") (moment 1970 #:tz "America/New_York")) #t
> (moment>? (moment 1970) (moment 1969 7 21 2 56)) #t
value
> (moment-order (moment 1970 1 1) (moment 1970)) '=
> (moment-order (moment 1970) (moment 1969 7 21 2 56)) '>
> (moment-order (moment 1969 7 21 2 56) (moment 1970)) '<
> (make-splay-tree moment-order) #<compact-splay-tree*>