Previous: , Up: Time and Date   [Contents][Index]

5.31.3 Parsing Dates

The date Lisp library provides rudimentary support for parsing date and time descriptions to their individual components, and to timestamps. Evaluate the form (require 'date) to load this library.

Function: parse-date string #!optional start

Returns a vector encoding the date described by string. If start is defined, it specifies the index of the character in the string to start parsing from.

Each element of the vector contains a separate component of the overall point in time described by the string. The indices of these elements are defined by the following constants:


The abbreviated name of the day of the week.


The numeric day of the month, counting from one.


The abbreviated name of the month.


The numeric month of the year, counting from January equals one.


The numeric year.


The numeric hour of the day.


The numeric minute of the hour.


The numeric second of the minute.


If true, a string defining the timezone.


The timestamp (see Timestamps), including the effects of the timezone, if given.

    ⇒ "Wed Jun  2 18:37:17 1999"

(parse-date (current-time-string))
    ⇒ ["Wed" 2 "Jun" 6 1999 18 37 17 0 (10744 . 67037)]

(parse-date "1999-06-02")
    ⇒ ["Tue" 2 "Jun" 6 1999 0 0 0 0 (10744 . 0)]

(parse-date "June 6, 1999")
    ⇒ ["" 0 "Jun" 6 1999 0 0 0 0 (10742 . 0)]

(aref (parse-date "June 6, 1999") date-vec-epoch-time)
    ⇒ (10742 . 0)

XXX provide more information on accepted formats, outputs for incomplete descriptions, etc…

Previous: , Up: Time and Date   [Contents][Index]