Next: Timers, Previous: Time of Day, Up: System Interface [Contents][Index]
These functions convert time values (lists of two or three integers)
to strings or to calendrical information. There is also a function to
convert calendrical information to a time value. You can get time
values from the functions current-time
(see Time of Day) and
file-attributes
(see File Attributes).
This function converts time to a string according to format-string. If time is omitted, it defaults to the current time. The argument format-string may contain ‘%’-sequences which say to substitute parts of the time. Here is a table of what the ‘%’-sequences mean:
This stands for the abbreviated name of the day of week.
This stands for the full name of the day of week.
This stands for the abbreviated name of the month.
This stands for the full name of the month.
This is a synonym for ‘%x %X’.
This has a locale-specific meaning. In the default locale (named C), it is equivalent to ‘%A, %B %e, %Y’.
This stands for the day of month, zero-padded.
This is a synonym for ‘%m/%d/%y’.
This stands for the day of month, blank-padded.
This is a synonym for ‘%b’.
This stands for the hour (00-23).
This stands for the hour (00-12).
This stands for the day of the year (001-366).
This stands for the hour (0-23), blank padded.
This stands for the hour (1-12), blank padded.
This stands for the month (01-12).
This stands for the minute (00-59).
This stands for a newline.
This stands for ‘AM’ or ‘PM’, as appropriate.
This is a synonym for ‘%I:%M:%S %p’.
This is a synonym for ‘%H:%M’.
This stands for the seconds (00-60).
This stands for a tab character.
This is a synonym for ‘%H:%M:%S’.
This stands for the week of the year (01-52), assuming that weeks start on Sunday.
This stands for the numeric day of week (0-6). Sunday is day 0.
This stands for the week of the year (01-52), assuming that weeks start on Monday.
This has a locale-specific meaning. In the default locale (named C), it is equivalent to ‘%D’.
This has a locale-specific meaning. In the default locale (named C), it is equivalent to ‘%T’.
This stands for the year without century (00-99).
This stands for the year with century.
This stands for the time zone abbreviation.
This function converts a time value into calendrical information. The
optional specified-time should be a list of
(high low . ignored) or (high . low), as from
current-time
and file-attributes
, or nil
to use the
current time.
The return value is a list of nine elements, as follows:
(seconds minutes hour day month year dow dst zone)
Here is what the elements mean:
The number of seconds past the minute, as an integer between 0 and 59.
The number of minutes past the hour, as an integer between 0 and 59.
The hour of the day, as an integer between 0 and 23.
The day of the month, as an integer between 1 and 31.
The month of the year, as an integer between 1 and 12.
The year, an integer typically greater than 1900.
The day of week, as an integer between 0 and 6, where 0 stands for Sunday.
t
if daylight savings time is effect, otherwise nil
.
An integer indicating the time zone, as the number of seconds east of Greenwich.
Note: Common Lisp has different meanings for dow and zone.
This function is the inverse of decode-time
. It converts seven
items of calendrical data into a time value. For the meanings of the
arguments, see the table above under decode-time
.
Year numbers less than 100 are treated just like other year numbers. If
you want them to stand for years above 1900, you must alter them yourself
before you call encode-time
.
The optional argument zone defaults to the current time zone and
its daylight savings time rules. If specified, it can be either a list
(as you would get from current-time-zone
) or an integer (as you
would get from decode-time
). The specified zone is used without
any further alteration for daylight savings time.
Next: Timers, Previous: Time of Day, Up: System Interface [Contents][Index]