Next: 2.16 Random Number Generation
Up: 2 Design Choices and
Previous: 2.14.3 Miscellaneous Filesystem Operations
Functions are provided to allow parsing strings containing time information
and printing time in various formats are available.
[Function]
extensions:parse-time time-string
&key :error-on-mismatch :default-seconds
:default-minutes :default-hours
:default-day :default-month
:default-year :default-zone
:default-weekday
parse-time accepts a string containing a time (e.g.,
"Jan 12, 1952") and returns the universal time if it is
successful. If it is unsuccessful and the keyword argument
:error-on-mismatch is non-nil, it signals an error.
Otherwise it returns nil. The other keyword arguments have the
following meaning:
- :default-seconds
- specifies the default value for the
seconds value if one is not provided by time-string. The
default value is 0.
- :default-minutes
- specifies the default value for the
minutes value if one is not provided by time-string. The
default value is 0.
- :default-hours
- specifies the default value for the hours
value if one is not provided by time-string. The default
value is 0.
- :default-day
- specifies the default value for the day
value if one is not provided by time-string. The default
value is the current day.
- :default-month
- specifies the default value for the month
value if one is not provided by time-string. The default
value is the current month.
- :default-year
- specifies the default value for the year
value if one is not provided by time-string. The default
value is the current year.
- :default-zone
- specifies the default value for the time
zone value if one is not provided by time-string. The
default value is the current time zone.
- :default-weekday
- specifies the default value for the day
of the week if one is not provided by time-string. The
default value is the current day of the week.
Any of the above keywords can be given the value :current which
means to use the current value as determined by a call to the
operating system.
[Function]
extensions:format-universal-time
dest universal-time
&key :timezone
:style :date-first
:print-seconds :print-meridian
:print-timezone :print-weekday
extensions:format-decoded-time
dest seconds minutes hours day month year
&key :timezone
:style :date-first
:print-seconds :print-meridian
:print-timezone :print-weekday
format-universal-time formats the time specified by
universal-time. format-decoded-time formats the time
specified by seconds, minutes, hours, day,
month, and year. Dest is any destination
accepted by the format function. The keyword arguments have
the following meaning:
- :timezone
- is an integer specifying the hours west of
Greenwich. :timezone defaults to the current time zone.
- :style
- specifies the style to use in formatting the
time. The legal values are:
- :short
- specifies to use a numeric date.
- :long
- specifies to format months and weekdays as
words instead of numbers.
- :abbreviated
- is similar to long except the words are
abbreviated.
- :government
- is similar to abbreviated, except the
date is of the form ``day month year'' instead of ``month day,
year''.
- :date-first
- if non-nil (default) will place the
date first. Otherwise, the time is placed first.
- :print-seconds
- if non-nil (default) will format
the seconds as part of the time. Otherwise, the seconds will be
omitted.
- :print-meridian
- if non-nil (default) will format
``AM'' or ``PM'' as part of the time. Otherwise, the ``AM'' or
``PM'' will be omitted.
- :print-timezone
- if non-nil (default) will format
the time zone as part of the time. Otherwise, the time zone will
be omitted.
- :print-weekday
- if non-nil (default) will format
the weekday as part of date. Otherwise, the weekday will be
omitted.
Next: 2.16 Random Number Generation
Up: 2 Design Choices and
Previous: 2.14.3 Miscellaneous Filesystem Operations
Raymond Toy
Mon Jul 14 09:11:27 EDT 1997