Variable: time-stamp-format
time-stamp-format is a customizable variable defined in
time-stamp.el.gz.
Value
"%Y-%m-%d %H:%M:%S %l"
Documentation
Format of the string inserted by M-x time-stamp (time-stamp).
The string is inserted verbatim except for character sequences beginning with %, which are converted as follows:
%A weekday name: Monday %a abbreviated weekday name: Mon
%B month name: January %b abbreviated month name: Jan
%d day of month
%H 24-hour clock hour %I 12-hour clock hour
%m month number
%M minute
%p meridian indicator: AM, PM
%S seconds
%w day number of week, Sunday is 0
%Y 4-digit year %y 2-digit year
%Z time zone name: EST
%-z zone offset with hour: -08 %:::z adds colons as needed: +05:30
%5z zone offset with mins: -0800 %:z adds colon: -08:00
Non-date items:
%% literal percent character: "%"
%f file name without directory %F absolute file name
%l login name %L full name of logged-in user
%q unqualified host name %Q fully-qualified host name
%h mail host name
The % may be followed by a modifier affecting the letter case.
The modifier "#" changes the case of letters, usually to uppercase,
or if the word is already uppercase, to lowercase.
The modifier "^" converts letters to uppercase;
"^" may be followed by "#" to convert to lowercase.
The modifier "*" converts words to title case (capitalized).
Here are some example conversions on Mondays, in two locales:
English French
%A Monday lundi
%^A MONDAY LUNDI
%^#A monday lundi
%*A Monday Lundi
Decimal digits before the type character specify the minimum field width. A "0" before the field width adds insignificant zeroes as appropriate, otherwise the padding is done with spaces.
If no padding is specified, a field that can be one or two digits is padded with "0" to two digits if necessary. Follow the % with "_" to pad with a space instead, or follow it with "-" to suppress this padding entirely. Thus, on the 5th of the month, the day is converted as follows:
"%d" -> "05"
"%_d" -> " 5"
"%-d" -> "5"
For example, to get a common format used by the "date" command, use "%a %b %_d %H:%M:%S %Z %Y".
The values of non-numeric formatted items depend on the locale
setting recorded in system-time-locale and locale-coding-system.
The examples here are for the default ("C") locale.
time-stamp-time-zone controls the time zone used.
Some of the conversions recommended here work only in Emacs 27 or later. The title-case and lowercase modifiers work only in Emacs 31 or later. If your files might be edited by older versions of Emacs also, you should limit yourself to the formats recommended by that older version.
This variable was added, or its default value changed, in Emacs 31.1.
Probably introduced at or before Emacs version 19.16.
Source Code
;; Defined in /usr/src/emacs/lisp/time-stamp.el.gz
(defcustom time-stamp-format "%Y-%m-%d %H:%M:%S %l"
"Format of the string inserted by \\[time-stamp].
The string is inserted verbatim except for character sequences beginning
with %, which are converted as follows:
%A weekday name: `Monday' %a abbreviated weekday name: `Mon'
%B month name: `January' %b abbreviated month name: `Jan'
%d day of month
%H 24-hour clock hour %I 12-hour clock hour
%m month number
%M minute
%p meridian indicator: `AM', `PM'
%S seconds
%w day number of week, Sunday is 0
%Y 4-digit year %y 2-digit year
%Z time zone name: `EST'
%-z zone offset with hour: `-08' %:::z adds colons as needed: `+05:30'
%5z zone offset with mins: `-0800' %:z adds colon: `-08:00'
Non-date items:
%% literal percent character: \"%\"
%f file name without directory %F absolute file name
%l login name %L full name of logged-in user
%q unqualified host name %Q fully-qualified host name
%h mail host name
The % may be followed by a modifier affecting the letter case.
The modifier \"#\" changes the case of letters, usually to uppercase,
or if the word is already uppercase, to lowercase.
The modifier \"^\" converts letters to uppercase;
\"^\" may be followed by \"#\" to convert to lowercase.
The modifier \"*\" converts words to title case (capitalized).
Here are some example conversions on Mondays, in two locales:
English French
%A Monday lundi
%^A MONDAY LUNDI
%^#A monday lundi
%*A Monday Lundi
Decimal digits before the type character specify the minimum field
width. A \"0\" before the field width adds insignificant zeroes
as appropriate, otherwise the padding is done with spaces.
If no padding is specified, a field that can be one or two digits is
padded with \"0\" to two digits if necessary. Follow the % with \"_\"
to pad with a space instead, or follow it with \"-\" to suppress this
padding entirely.
Thus, on the 5th of the month, the day is converted as follows:
\"%d\" -> \"05\"
\"%_d\" -> \" 5\"
\"%-d\" -> \"5\"
For example, to get a common format used by the \"date\" command,
use \"%a %b %_d %H:%M:%S %Z %Y\".
The values of non-numeric formatted items depend on the locale
setting recorded in `system-time-locale' and `locale-coding-system'.
The examples here are for the default (\"C\") locale.
`time-stamp-time-zone' controls the time zone used.
Some of the conversions recommended here work only in Emacs 27 or later.
The title-case and lowercase modifiers work only in Emacs 31 or later.
If your files might be edited by older versions of Emacs also, you should
limit yourself to the formats recommended by that older version."
:type 'string
:version "31.1")