Generic FunctionPackage:
Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version


Arguments: time-intervalspec &key start end

Returns the time-interval denoted by the ISO-8601 time-intervalspec. time-intervalspec should be a time-interval designator. start and end are bounding index designators of time-intervalspec. The defaults for start and end are 0 and nil, respectively.

ISO 8601 specifies textual representations for time-intervals. They may be specified in four ways:

  1. Start and end, such as 2002-03-01T13:00:00Z/2003-05-11T15:30:00Z
  2. Start and duration, such as 2002-03-01T13:00:00Z/P1Y2M10DT2H30M
  3. Duration and end, such as P1Y2M10DT2H30M/2003-05-11T15:30:00Z
  4. Duration only, such as P1Y2M10DT2H30M


(require :datetime)

 ;; The following time-interval specifies a start time and an end time.
 (setq ti (time-interval "19850412T232050/19850625T103000"))
=> #<time-interval 1985-04-12T23:20:50/1985-06-25T10:30:00 @ ...>

 (time-interval-start ti)
=> #<date-time "1985-04-12T23:20:50" @ ...>

 (time-interval-end ti)
=> #<date-time "1985-06-25T10:30:00" @ ...>

 ;; No duration was specified in ti
 (time-interval-duration ti)
=> nil

 ;; The following time-interval specifies a duration.
 (setq ti2 (time-interval "P2Y10M15DT10H30M20S"))
=> #<time-interval P2Y10M15DT10H30M20S @ ...>

 (time-interval-duration ti2)
=> #<duration 2Y10M15DT10H30M20S @ ...>

 (duration-years (time-interval-duration ti2)) => 2

See also duration, time-interval-start, time-interval-end, time-interval-duration, and time-interval-recurrences.

A repeating interval is formed by adding "Rn/" to the beginning of an interval expression. For example, to repeat the interval P1Y2M10DT2H30M five times starting at 2002-03-01T13:00:00Z, use R5/2002-03-01T13:00:00Z/P1Y2M10DT2H30M

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 8.2 page.
Created 2012.5.30.

Allegro CL version 9.0
Unrevised from 8.2 to 9.0.
8.2 version