FunctionPackage: exclToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.

date>

Arguments: ut1 ut2

The value returned by date> and related functions depends on the time zone where the machine running Lisp is located and also on whether daylight saving time is in effect. See the discussion in Day and date calculation functions in miscellaneous.htm for examples of how time zone and daylight saving time can affect results.

This function performs calculations on the day/date portion of a universal time, that is the decoded universal time ignoring the second, minute, and hour values (see decode-universal-time).

ut1 and ut2 should be non-negative integers and are interpreted as universal times (see get-universal-time). If the date of ut1 is later than the date of ut2, this function returns t. Otherwise it returns nil. The date is determined by the date, month, and year obtained by applying decode-universal-time to a universal time (that is, the fourth, fifth, and sixth values returned by decode-universal-time.)

If ut1 is less than or equal to ut2, this function returns nil (as the date of ut1 must then be less than or equal to the date of ut2).

If ut1 is greater than ut2, then each time is decoded (with decode-universal-time) using the system timezone, and the year (sixth value), month (fifth value) and date (fourth value) are compared. t is returned if the year of ut1 is greater than the year of ut2, or, if they are the same, the month of ut1 is greater than the month of ut2, or, if they are also the same, the date of ut1 is greater than the date of ut2. If the year, month, and date are the same for ut1 and ut2, nil is returned.

;; Results depend on the timezone value and whether daylight saving
;; time is in effect. These are not settable by this function and
;; the values are inherited from the Operating system. To see them,
;; evaluate (decode-universal-time (get-universal-time)):

cl-user(29): (decode-universal-time (get-universal-time))
RETURNS 11 38 14 5 12 2017 1 nil 8

;; That form was evaluated at 2:38:11 PM (14:38:11) on Tuesday,
;; December 5 at Franz Inc. HQ in Oakland, California. The eighth
;; return value (nil) indicates daylight saving time was not in effect.
;; The ninth return value (8) means the timezone was 8, 8 hours
;; earlier than Greenwich Mean Time (GMT). If you are in a different
;; location or the date is different, you will get different values.

cl-user(32): (setq ut1 (encode-universal-time 0 0 8 4 12 2017))
3721392000             ;; December 4, 2017
cl-user(33): 
cl-user(33): (setq ut2 (encode-universal-time 0 0 20 4 12 2017))
3721435200             ;; also December 4, 2017
cl-user(34): (date> ut2 ut1)
nil
cl-user(35): (date> ut1 ut2)
nil
;; False for both argument orders because the same day

cl-user(36): (setq ut3 (encode-universal-time 0 0 8 4 11 2017))
3718796400             ;; November 4, 2017
cl-user(37): (date> ut1 ut3)
t
cl-user(38): (date> ut3 ut1)
nil
;; Different days so one direction true, the other false.

See Day and date calculation functions in miscellaneous.htm for more information on this and related functions.


Copyright (c) 1998-2017, Franz Inc. Oakland, CA., USA. All rights reserved.
This page is new in the 10.1 release.
Created 2017.2.15.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.1
New since the initial 10.1 release.