Function | Package: excl | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 New since the initial 10.1 release.

## day-number

Arguments: ut

The value returned by day-number 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).

This function returns the day number of the universal time ut, which must be a non-negative integer and is interpreted as a universal time (see get-universal-time). January 1 has day number 1 and December 31 has day number 365 in non-leap years and 366 in leap years.

    ;; 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.

    ;; January 1 has day-number 1. Here is January 1, 2005:
    cl-user(94): (day-number (encode-universal-time 0 0 12 1 1 2005))
    1

    ;; December 31 has day number 365 in non-leap years (like 2005)
    ;; and 366 in leap years (like 2004):

    cl-user(97): (day-number (encode-universal-time 0 0 12 31 12 2005))
    365
    cl-user(98): (day-number (encode-universal-time 0 0 12 31 12 2004))
    366
    cl-user(99):

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.

|  | ToC | DocOverview | CGDoc | RelNotes | FAQ | Index | PermutedIndex
| Allegro CL version 10.1 New since the initial 10.1 release.