7 Generic Date Operations
value
gen:date-provider : any/c
procedure
(date-provider? x) → boolean?
x : any/c
procedure
d : date-provider?
> (->date (date 2000 1 1)) #<date 2000-01-01>
> (->date (datetime 1969 7 21 2 56)) #<date 1969-07-21>
> (->date (moment 2015 3 8 1 #:tz "America/New_York")) #<date 2015-03-08>
procedure
(->jdn d) → exact-integer?
d : date-provider?
> (->jdn (date 1970)) 2440588
> (->jdn (datetime 1969 7 21 2 56)) 2440424
> (->jdn (moment 2015 3 8 1 #:tz "America/New_York")) 2457090
procedure
(->year d) → exact-integer?
d : date-provider?
> (->year (date 1970)) 1970
> (->year (datetime -3 3 3 3 33 33)) -3
> (->year (moment 2015 3 8 1 #:tz "America/New_York")) 2015
procedure
(->quarter d) → exact-integer?
d : date-provider?
> (->quarter (date 1970 1 1)) 1
> (->quarter (datetime 1970 4 1)) 2
> (->quarter (moment 1970 7 1 #:tz "America/New_York")) 3
> (->quarter (moment 1970 10 1 #:tz "Etc/UTC")) 4
procedure
(->month d) → exact-integer?
d : date-provider?
> (->month (date 1970)) 1
> (->month (datetime -3 3 3 3 33 33)) 3
> (->month (moment 2015 3 8 1 #:tz "America/New_York")) 3
procedure
(->day d) → exact-integer?
d : date-provider?
> (->day (date 1970)) 1
> (->day (datetime 1980 2 29)) 29
> (->day (moment 2015 3 8 1 #:tz "America/New_York")) 8
procedure
(->wday d) → exact-integer?
d : date-provider?
> (->wday (date 1970)) 4
> (->wday (datetime 1980 2 29)) 5
> (->wday (moment 2015 3 8 1 #:tz "America/New_York")) 0
procedure
(->yday d) → exact-integer?
d : date-provider?
> (->yday (date 1970)) 1
> (->yday (datetime 1980 12 31)) 366
> (->yday (moment 2015 12 31 #:tz "America/New_York")) 365
procedure
(->iso-week d) → exact-integer?
d : date-provider?
> (->iso-week (date 2005 1 1)) 53
> (->iso-week (datetime 2007 1 1)) 1
> (->iso-week (moment 2008 12 31 #:tz "America/New_York")) 1
procedure
(->iso-wyear d) → exact-integer?
d : date-provider?
> (->iso-wyear (date 2005 1 1)) 2004
> (->iso-wyear (datetime 2007 1 1)) 2007
> (->iso-wyear (moment 2008 12 31 #:tz "America/New_York")) 2009
procedure
(->iso-wday d) → exact-integer?
d : date-provider?
> (->iso-wday (date 1970)) 4
> (->iso-wday (datetime 1980 2 29)) 5
> (->iso-wday (moment 2015 3 8 1 #:tz "America/New_York")) 7
procedure
d : date-provider?
procedure
d : date-provider?
procedure
d : date-provider?
procedure
(wednesday? d) → boolean?
d : date-provider?
procedure
d : date-provider?
procedure
d : date-provider?
procedure
d : date-provider?
procedure
(at-time d t [#:resolve-offset resolve]) → datetime-provider?
d : date-provider? t : time-provider? resolve : offset-resolver/c = resolve-offset/raise
> (at-time (date 1970) (time 14 30)) #<datetime 1970-01-01T14:30:00>
> (at-time (datetime 2015 3 8 2) (time 2)) #<datetime 2015-03-08T02:00:00>
> (at-time (moment 2015 3 8 #:tz "America/New_York") (time 2) #:resolve-offset resolve-offset/post) #<moment 2015-03-08T03:00:00-04:00[America/New_York]>
procedure
(at-midnight d [#:resolve-offset resolve]) → datetime-provider?
d : date-provider? resolve : offset-resolver/c = resolve-offset/raise
procedure
(at-noon d [#:resolve-offset resolve]) → datetime-provider?
d : date-provider? resolve : offset-resolver/c = resolve-offset/raise