parse-durationDate and Timepretty-durationparse-timeGoTo Top

parse-time   string &key start end junk-allowed separators => second, minute, hour, time-zone, daylight-savings-p, pos[Function]

Purpose
Parse a time-of-day specification string.

Package   :gbbopen-tools

Module   :gbbopen-tools

Arguments and values

string     A simple 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 hour, minute, and second fields in string, if needed (default is " :")
second     An integer between 0 and up to 59, inclusive
minute     An integer between 0 and up to 59, inclusive
hour     An integer between 0 and up to 23, inclusive
time-zone     A time zone: a rational multiple of 1/3600 between -24 and 24 that represents the number of hours offset from GMT
daylight-savings-p     A generalized boolean
position     A index in string

Returns
Six values: second, minute, hour, time-zone, daylight-savings-p, and position

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
If no hour, minute, or second values are specified in string, they default to zero. The values returned for time-zone and daylight-savings-p will be nil unless a time-zone is specified in string.

The returned position is the index within string where the parse ended.

See also
    encode-date-and-time
    encode-time-of-day
    parse-date
    parse-date-and-time
    parse-duration
    parse-time

Examples

  > (parse-time "10:30")
  0
  30
  10
  nil
  nil
  5
  > (parse-time "10:30pm")
  0
  30
  22
  nil
  nil
  7
  > (parse-time "10:30 EDT")
  0
  30
  10
  4
  t
  9
  > (parse-time "10:30 IST")
  0
  30
  10
  -11/2
  nil
  9
  > (parse-time "10:30 UTC-7")
  0
  30
  10
  7
  nil
  11
  >


The GBBopen Project


parse-durationDate and Timepretty-durationparse-timeGoTo Top