message-log-date-and-timeDate and Timepretty-run-time-intervalparse-dateGoTo Top

parse-date   string &key start end junk-allowed separators month-precedes-date => date, month, year[Function]

Purpose
Parse a date-specification string.

Package   :gbbopen-tools (home package is :module-manager)

Module   :module-manager

Arguments and values

string     A string
start     Starting index into string (default is 0)
end     Ending index into string (default is nil, meaning end of string)
junk-allowed     A generalized boolean (default is nil)
separators     A sequence of characters that are skipped and separate the date, month, and year fields in string, if needed (default is "-/ ,")
month-precedes-date     A generalized boolean (default is *month-precedes-date*)
date     An integer between 1 and up to 31, inclusive, depending on the month and year
month     An integer between 1 and 12, inclusive
year     An integer

Returns
Three values: date, month, and year

Errors
If junk-allowed is false, an error is signaled if a numeric field in string does not consist entirely of the representation of a integer, possibly surrounded on either side by characters in separators.

Description
Both the month and date must be specified in string, optionally followed by the year. The month can be a numeric value (1–12), a three-letter abbreviation, or the full month name. If the month is specified numerically, then the value of month-precedes-date is used to determine the month and date ordering. If no year is specified in string, the current year is assumed, unless the specified month and date have passed, in which case next year is assumed.

See also
    *month-precedes-date*

Examples

  > (parse-date "1 Apr 2010")
  1
  4
  2010
  > (parse-date "April 1, 2010")
  1
  4
  2010
  > (parse-date "1-4-10" :month-precedes-date 't)
  4
  1
  2010
  > (parse-date "1-4-10" :month-precedes-date nil)
  1
  4
  2010
  > (parse-date "4 Jul") ;; entered before July 4, 2008
  4
  7
  2008
  > (parse-date "4/7" :month-precedes-date nil)
  4
  7
  2008
  >

Note
This function is loaded with the :module-manager module in order to to make it available as early as possible.


The GBBopen Project


message-log-date-and-timeDate and Timepretty-run-time-intervalparse-dateGoTo Top