local-time

API Reference

cl-postgres+local-time

Integration between cl-postgres and local-time

No packages.

local-time

A library for manipulating dates and times, based on a paper by Erik Naggum

LOCAL-TIME

  • Class TIMESTAMP
    DAY   Accessor: DAY-OF
    SEC   Accessor: SEC-OF
    NSEC   Accessor: NSEC-OF
  • Type TIME-OF-DAY
  • Type DATE
  • Variable *DEFAULT-TIMEZONE*
  • Variable +MONTH-NAMES+
    #("" "january" "february" "march" "april" "may" "june" "july" "august"
      "september" "october" "november" "december")
  • Variable +SHORT-MONTH-NAMES+
    #("" "jan" "feb" "mar" "apr" "may" "jun" "jul" "aug" "sep" "oct" "nov" "dec")
  • Variable +DAY-NAMES+
    #("sunday" "monday" "tuesday" "wednesday" "thursday" "friday" "saturday")
  • Variable +SHORT-DAY-NAMES+
    #("sun" "mon" "tue" "wed" "thu" "fri" "sat")
  • Variable +MONTHS-PER-YEAR+
    12
  • Variable +DAYS-PER-WEEK+
    7
  • Variable +HOURS-PER-DAY+
    24
  • Variable +MINUTES-PER-DAY+
    1440
  • Variable +MINUTES-PER-HOUR+
    60
  • Variable +SECONDS-PER-DAY+
    86400
  • Variable +SECONDS-PER-HOUR+
    3600
  • Variable +SECONDS-PER-MINUTE+
    60
  • Variable +ISO-8601-DATE-FORMAT+
    '((:year 4) #\- (:month 2) #\- (:day 2))
  • Variable +ISO-8601-TIME-FORMAT+
    '((:hour 2) #\: (:min 2) #\: (:sec 2) #\. (:usec 6))
  • Variable +ISO-8601-FORMAT+
    (append local-time:+iso-8601-date-format+ (list #\t)
            local-time:+iso-8601-time-format+ (list :gmt-offset-or-z))
  • Variable +RFC3339-FORMAT+
    local-time:+iso-8601-format+
  • Variable +RFC3339-FORMAT/DATE-ONLY+
    '((:year 4) #\- (:month 2) #\- (:day 2))
  • Variable +ASCTIME-FORMAT+
    '(:short-weekday #\  :short-month #\  (:day 2 #\ ) #\  (:hour 2) #\: (:min 2)
      #\: (:sec 2) #\  (:year 4))
  • Variable +RFC-1123-FORMAT+
    '(:short-weekday ", " (:day 2) #\  :short-month #\  (:year 4) #\  (:hour 2) #\:
      (:min 2) #\: (:sec 2) #\  :gmt-offset-hhmm)
    See the RFC 1123 for the details about the possible values of the timezone field.
  • Variable +ISO-WEEK-DATE-FORMAT+
    '((:iso-week-year 4) #\- #\w (:iso-week-number 2) #\- (:iso-week-day 1))
  • Variable +UTC-ZONE+
    (local-time::%make-simple-timezone "coordinated universal time" "utc" 0)
  • Variable +GMT-ZONE+
    (local-time::%make-simple-timezone "greenwich mean time" "gmt" 0)
  • Macro DEFINE-TIMEZONE (zone-name zone-file &key (load nil))
    Define zone-name (a symbol or a string) as a new timezone, lazy-loaded from zone-file (a pathname designator relative to the zoneinfo directory on this system. If load is true, load immediately.
  • Variable *DEFAULT-TIMEZONE*
    (local-time::make-timezone :path local-time::default-timezone-file :name
                               "*default-timezone*")
  • Function FIND-TIMEZONE-BY-LOCATION-NAME (name)
  • Function REREAD-TIMEZONE-REPOSITORY (&key (timezone-repository *default-timezone-repository-path*))
  • Macro MAKE-TIMESTAMP (&rest args)
  • Function CLONE-TIMESTAMP (timestamp)
  • Function TIMESTAMP-SUBTIMEZONE (timestamp timezone)
    Return as multiple values the time zone as the number of seconds east of UTC, a boolean daylight-saving-p, and the customary abbreviation of the timezone.
  • Function TIMESTAMP-MINIMIZE-PART (timestamp part &key (timezone *default-timezone*) into)
  • Function TIMESTAMP-MAXIMIZE-PART (timestamp part &key (timezone *default-timezone*) into)
  • Macro WITH-DECODED-TIMESTAMP ((&key nsec sec minute hour day month year day-of-week daylight-p timezone offset) timestamp &body forms)
    This macro binds variables to the decoded elements of TIMESTAMP. The TIMEZONE argument is used for decoding the timestamp, and is not bound by the macro. The value of DAY-OF-WEEK starts from 0 which means Sunday.
  • Function DAYS-IN-MONTH (month year)
    Returns the number of days in the given month of the specified year.
  • Macro ADJUST-TIMESTAMP (timestamp &body changes)
  • Macro ADJUST-TIMESTAMP! (timestamp &body changes)
  • Function TIMESTAMP-WHOLE-YEAR-DIFFERENCE (time-a time-b)
    Returns the number of whole years elapsed between time-a and time-b (hint: anniversaries).
  • Function TIMESTAMP-DIFFERENCE (time-a time-b)
    Returns the difference between TIME-A and TIME-B in seconds
  • Function TIMESTAMP+ (time amount unit &optional (timezone *default-timezone*) offset)
  • Function TIMESTAMP- (time amount unit &optional (timezone *default-timezone*) offset)
  • Function TIMESTAMP-DAY-OF-WEEK (timestamp &key (timezone *default-timezone*) offset)
  • Function ENCODE-TIMESTAMP (nsec sec minute hour day month year &key (timezone *default-timezone*) offset into)
    Return a new TIMESTAMP instance corresponding to the specified time elements.
  • Function UNIVERSAL-TO-TIMESTAMP (universal &key (nsec 0))
    Returns a timestamp corresponding to the given universal time.
  • Function TIMESTAMP-TO-UNIVERSAL (timestamp)
    Return the UNIVERSAL-TIME corresponding to the TIMESTAMP
  • Function UNIX-TO-TIMESTAMP (unix &key (nsec 0))
    Return a TIMESTAMP corresponding to UNIX, which is the number of seconds since the unix epoch, 1970-01-01T00:00:00Z.
  • Function TIMESTAMP-TO-UNIX (timestamp)
    Return the Unix time corresponding to the TIMESTAMP
  • Variable *CLOCK*
    t
    Use the `*clock*' special variable if you need to define your own idea of the current time. The value of this variable should have the methods `local-time::clock-now', and `local-time::clock-today'. The currently supported values in local-time are: t - use the standard clock local-time:leap-second-adjusted - use a clock which adjusts for leap seconds using the information in *default-timezone*.
  • Function NOW
    Returns a timestamp representing the present moment.
  • Function TODAY
    Returns a timestamp representing the present day.
  • Generic-Function CLOCK-NOW (clock)
    Returns a timestamp for the current time given a clock.
  • Generic-Function CLOCK-TODAY (clock)
    Returns a timestamp for the current date given a clock. The date is encoded by convention as a timestamp with the time set to 00:00:00UTC.
  • Method CLOCK-NOW ((clock (eql 'leap-second-adjusted)))
  • Method CLOCK-NOW (clock)
  • Method CLOCK-TODAY (clock)
  • Function TIMESTAMP< (&rest times)
  • Function TIMESTAMP<= (&rest times)
  • Function TIMESTAMP> (&rest times)
  • Function TIMESTAMP>= (&rest times)
  • Function TIMESTAMP= (&rest times)
  • Function TIMESTAMP/= (&rest timestamps)
    Returns T if no pair of timestamps is equal. Otherwise return NIL.
  • Function TIMESTAMP-MINIMUM (time &rest times)
    Returns the earliest timestamp
  • Function TIMESTAMP-MAXIMUM (time &rest times)
    Returns the latest timestamp
  • Function DECODE-TIMESTAMP (timestamp &key (timezone *default-timezone*) offset)
    Returns the decoded time as multiple values: nsec, ss, mm, hh, day, month, year, day-of-week
  • Function TIMESTAMP-YEAR (timestamp &key (timezone *default-timezone*))
    Returns the cardinal year upon which the timestamp falls.
  • Function TIMESTAMP-CENTURY (timestamp &key (timezone *default-timezone*))
    Returns the ordinal century upon which the timestamp falls.
  • Function TIMESTAMP-MILLENNIUM (timestamp &key (timezone *default-timezone*))
    Returns the ordinal millennium upon which the timestamp falls.
  • Function TIMESTAMP-DECADE (timestamp &key (timezone *default-timezone*))
    Returns the cardinal decade upon which the timestamp falls.
  • Function TIMESTAMP-MONTH (timestamp &key (timezone *default-timezone*))
    Returns the month upon which the timestamp falls.
  • Function TIMESTAMP-DAY (timestamp &key (timezone *default-timezone*))
    Returns the day of the month upon which the timestamp falls.
  • Function TIMESTAMP-HOUR (timestamp &key (timezone *default-timezone*))
  • Function TIMESTAMP-MINUTE (timestamp &key (timezone *default-timezone*))
  • Function TIMESTAMP-SECOND (timestamp &key (timezone *default-timezone*))
  • Function TIMESTAMP-MICROSECOND (timestamp)
  • Function TIMESTAMP-MILLISECOND (timestamp)
  • Function PARSE-RFC3339-TIMESTRING (timestring &key (fail-on-error t) (allow-missing-time-part nil))
  • Function PARSE-TIMESTRING (timestring &key start end (fail-on-error t) (time-separator #\:) (date-separator #\-) (date-time-separator #\t) (allow-missing-elements t) (allow-missing-date-part allow-missing-elements) (allow-missing-time-part allow-missing-elements) (allow-missing-timezone-part allow-missing-elements) (offset 0))
    Parse a timestring and return the corresponding TIMESTAMP. See split-timestring for details. Unspecified fields in the timestring are initialized to their lowest possible value, and timezone offset is 0 (UTC) unless explicitly specified in the input string.
  • Function FORMAT-TIMESTRING (destination timestamp &key (format +iso-8601-format+) (timezone *default-timezone*))
    Constructs a string representation of TIMESTAMP according to FORMAT and returns it. If destination is T, the string is written to *standard-output*. If destination is a stream, the string is written to the stream. FORMAT is a list containing one or more of strings, characters, and keywords. Strings and characters are output literally, while keywords are replaced by the values here: :YEAR *year :MONTH *numeric month :DAY *day of month :HOUR *hour :MIN *minutes :SEC *seconds :WEEKDAY *numeric day of week starting from index 0, which means Sunday :MSEC *milliseconds :USEC *microseconds :NSEC *nanoseconds :ISO-WEEK-YEAR *year for ISO week date (can be different from regular calendar year) :ISO-WEEK-NUMBER *ISO week number (i.e. 1 through 53) :ISO-WEEK-DAY *ISO compatible weekday number (monday=1, sunday=7) :LONG-WEEKDAY long form of weekday (e.g. Sunday, Monday) :SHORT-WEEKDAY short form of weekday (e.g. Sun, Mon) :MINIMAL-WEEKDAY minimal form of weekday (e.g. Su, Mo) :LONG-MONTH long form of month (e.g. January, February) :SHORT-MONTH short form of month (e.g. Jan, Feb) :HOUR12 *hour on a 12-hour clock :AMPM am/pm marker in lowercase :GMT-OFFSET the gmt-offset of the time, in +00:00 form :GMT-OFFSET-OR-Z like :GMT-OFFSET, but is Z when UTC :GMT-OFFSET-HHMM like :GMT-OFFSET, but in +0000 form :TIMEZONE timezone abbrevation for the time Elements marked by * can be placed in a list in the form: (:keyword padding &optional (padchar #0)) The string representation of the value will be padded with the padchar. You can see examples in +ISO-8601-FORMAT+, +ASCTIME-FORMAT+, and +RFC-1123-FORMAT+.
  • Function FORMAT-RFC1123-TIMESTRING (destination timestamp &key (timezone *default-timezone*))
  • Function TO-RFC1123-TIMESTRING (timestamp)
  • Function FORMAT-RFC3339-TIMESTRING (destination timestamp &key omit-date-part omit-time-part (omit-timezone-part omit-time-part) (use-zulu t) (timezone *default-timezone*))
    Formats a timestring in the RFC 3339 format, a restricted form of the ISO-8601 timestring specification for Internet timestamps.
  • Function TO-RFC3339-TIMESTRING (timestamp)
  • Function ENABLE-READ-MACROS
    Enables the local-time reader macros for literal timestamps and universal time.
  • Function ASTRONOMICAL-JULIAN-DATE (timestamp)
    Returns the astronomical julian date referred to by the timestamp.
  • Function MODIFIED-JULIAN-DATE (timestamp)
    Returns the modified julian date referred to by the timestamp.