Next: Parsing Dates, Previous: Timestamps, Up: Time and Date [Contents][Index]
Given a timestamp value it is possible to format it as a string, in many different formats.
Return a string defining timestamp according to the string format. If timestamp is undefined, the current time is used.
The format string may include any of the formatting characters
from the C library’s strftime(3)
function. If undefined a
standard, fixed-width, format is used:
(current-time-string) ⇒ "Wed Jun 2 18:07:53 1999"
Some of the possible formatting substitutions include (this is copied from the GNU libc manual, see (libc)Formatting Date and Time):
The abbreviated weekday name according to the current locale.
The full weekday name according to the current locale.
The abbreviated month name according to the current locale.
The full month name according to the current locale.
The preferred date and time representation for the current locale.
The day of the month as a decimal number (range 01
to 31
).
The hour as a decimal number, using a 24-hour clock (range 00
to
23
).
The hour as a decimal number, using a 12-hour clock (range 01
to
12
).
The day of the year as a decimal number (range 001
to 366
).
The month as a decimal number (range 01
to 12
).
The minute as a decimal number.
Either ‘am’ or ‘pm’, according to the given time value; or the corresponding strings for the current locale.
The second as a decimal number.
The week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week.
The week number of the current year as a decimal number, starting with the first Monday as the first day of the first week.
The day of the week as a decimal number, Sunday being 0
.
The preferred date representation for the current locale, but without the time.
The preferred time representation for the current locale, but with no date.
The year as a decimal number, but without a century (range 00
to
99
).
The year as a decimal number, including the century.
The time zone or name or abbreviation (empty if the time zone can’t be determined).
A literal ‘%’ character.
(current-time-string nil "%Y-%m-%d") ⇒ "1999-06-02"
Next: Parsing Dates, Previous: Timestamps, Up: Time and Date [Contents][Index]