FunctionPackage: util.date-timeToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version

decode-date-time

Arguments: date-time

This function, the date-time analog of decode-universal-time, takes a date-time object and returns, as multiple value, its sizteen components plus the year and the zone. (So this function returns eighteen values in all.) Each value can be accessed individually with the appropriate reader function.

The argument can also be the keyqord :key, in which case the return value is a list of keywords identifying the 18 return values. Here is an example showing some of the return values for a date-time and some of the explanation keywords when the argument is :key:

 cl-user(3): (require :datetime)
 t
 cl-user(4): (use-package :util.date-time)
 t
 cl-user(5): (setq d (date-time "1985-04-12T23:20:50"))
 #<date-time "1985-04-12T23:20:50" @ #x71b527d2>
 cl-user(6): (multiple-value-list (decode-date-time d))
 (0 50 20 23 12 4 1985 nil 85 19 ...)
 cl-user(7): (decode-date-time :key)
 (:secondf :second :minute :hour :ymd-day :ymd-month :year :zone
  :ymd-yd-year-in-century :ymd-yd-century ...)

The return values, along with their type and the correcsponding reader function are:

  1. secondf: the fractional second, a rational. Reader is date-time-secondf.
  2. second: the second, an integer. Reader is date-time-second.
  3. minute: the minute, an integer. Reader is date-time-minute.
  4. hour: the hour, an integer. Reader is date-time-hour.
  5. ymd-day: the day in the month, an integer in the range 1 to 31. Reader is date-time-ymd-day.
  6. ymd-month: the month, an integer in the range 1 to 12. Reader is date-time-ymd-month.
  7. year: the year, an integer. Returned by date-time-year. year does not name a slot in a date-time instance. The year is calculated from the date-time-ymd-yd-before-year-0, date-time-ymd-yd-century, and date-time-ymd-yd-year-in-century slots of date-time.
  8. zone: the zone, a time zone or nil. Returned by date-time-zone. zone does not name a slot in a date-time instance. The zone is calculated from the date-time-zone-hour and date-time-zone-minute slots.
  9. ymd-yd-year-in-century: the year in the century, an integer from 0 to 99. (Thus 0 for 1900. Measured from year 0, so backwards for BCE years, that is 15 for -1415.) Reader is date-time-ymd-yd-year-in-century.
  10. ymd-yd-century: the century, and integer. 19 for 1900 to 1999, 20 for 2000 to 2099. Measured from year 0, so backwards for BCE years, that is 14 for -1415. Reader is date-time-ymd-yd-century.
  11. ymd-yd-before-year-0: a boolean indicating whether before year 0 (t) or after (nil). Reader is date-time-ymd-yd-before-year-0.
  12. yd-day: the day in the year, an integer from 1 to 366. Reader is date-time-yd-day.
  13. ywd-day: the day of the week, an integer from 1 (Monday) to 7 (Sunday). Reader is date-time-ywd-day.
  14. ywd-week: the week in the year, and integer from 1 to 53. Week 1 is the first week in the year to contain a Thursday. Day 1 of that week is Monday (as day 1 always is) so if Thursday is, say on New Year's day, the previous Monday is in the first week of the year despite actually being in the previous calendar year. Reader is date-time-ywd-week.
  15. ywd-year:
  16. ywd-year-in-decade
  17. ywd-decade-in-century
  18. ywd-century
  19. ywd-before-year-0

See date-time.htm for information on support in Allegro CL for parsing and generating time expressions using the ISO 8601 standard.


Copyright (c) 1998-2019, Franz Inc. Oakland, CA., USA. All rights reserved.
This page was not revised from the 9.0 page.
Created 2015.5.21.

ToCDocOverviewCGDocRelNotesFAQIndexPermutedIndex
Allegro CL version 10.0
Unrevised from 9.0 to 10.0.
9.0 version