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 and their relation to time zones 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 the same as 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.)

That is 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 of the year, month, and day are the same for both ut1 and ut2, nil is returned otherwise.

;; 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)
t
cl-user(35): (date= ut1 ut2)
t
;; True 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)
nil
cl-user(38): (date= ut3 ut1)
nil
;; Different days false for both argument orders

See Day and date calculation functions and their relation to time zones in miscellaneous.htm for more information on this and related functions.


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

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