Commit e3bb6f90 authored by Paul Eggert's avatar Paul Eggert

format-time-string: document new '+' flag

* doc/lispref/os.texi (Time Parsing), etc/NEWS:
* src/timefns.c (Fformat_time_string): Document the new
behavior, added for compatibility with POSIX.1-2017.
parent 0d49078a
Pipeline #858 passed with stage
in 57 minutes and 34 seconds
......@@ -1600,7 +1600,9 @@ This is a synonym for @samp{%m/%d/%y}.
@item %e
This stands for the day of month, blank-padded.
@item %F
This stands for the ISO 8601 date format, i.e., @samp{"%Y-%m-%d"}.
This stands for the ISO 8601 date format, which is like
@samp{%+4Y-%m-%d} except that any flags or field width override the
@samp{+} and (after subtracting 6) the @samp{4}.
@item %g
This stands for the year corresponding to the ISO week within the century.
@item %G
......@@ -1680,7 +1682,9 @@ This stands for a single @samp{%}.
@end table
One or more flag characters can appear immediately after the @samp{%}.
@samp{0} pads with zeros, @samp{_} pads with blanks, @samp{-}
@samp{0} pads with zeros, @samp{+} pads with zeros and also puts
@samp{+} before nonnegative year numbers with more than four digits,
@samp{_} pads with blanks, @samp{-}
suppresses padding, @samp{^} upper-cases letters, and @samp{#}
reverses the case of letters.
......
......@@ -1343,6 +1343,12 @@ floating-point operators do.
+++
** New function 'time-equal-p' compares time values for equality.
+++
** 'format-time-string' supports a new conversion specifier flag '+'
that acts like the '0' flag but also puts a '+' before nonnegative
years containing more than four digits. This is for compatibility
with POSIX.1-2017.
** 'define-minor-mode' automatically documents the meaning of ARG.
+++
......
......@@ -1267,7 +1267,7 @@ by text that describes the specified date and time in TIME:
%c is the locale's date and time format.
%x is the locale's "preferred" date format.
%D is like "%m/%d/%y".
%F is the ISO 8601 date format (like "%Y-%m-%d").
%F is the ISO 8601 date format (like "%+4Y-%m-%d").
%R is like "%H:%M", %T is like "%H:%M:%S", %r is like "%I:%M:%S %p".
%X is the locale's "preferred" time format.
......@@ -1275,17 +1275,23 @@ by text that describes the specified date and time in TIME:
Finally, %n is a newline, %t is a tab, %% is a literal %, and
unrecognized %-sequences stand for themselves.
Certain flags and modifiers are available with some format controls.
The flags are `_', `-', `^' and `#'. For certain characters X,
%_X is like %X, but padded with blanks; %-X is like %X,
but without padding. %^X is like %X, but with all textual
characters up-cased; %#X is like %X, but with letter-case of
all textual characters reversed.
%NX (where N stands for an integer) is like %X,
but takes up at least N (a number) positions.
The modifiers are `E' and `O'. For certain characters X,
%EX is a locale's alternative version of %X;
%OX is like %X, but uses the locale's number symbols.
A %-sequence can contain optional flags, field width, and a modifier
(in that order) after the `%'. The flags are:
`-' Do not pad the field.
`_' Pad with spaces.
`0' Pad with zeros.
`+' Pad with zeros and put `+' before nonnegative year numbers with >4 digits.
`^' Use upper case characters if possible.
`#' Use opposite case characters if possible.
A field width N is an unsigned decimal integer with a leading digit nonzero.
%NX is like %X, but takes up at least N positions.
The modifiers are:
`E' Use the locale's alternative version.
`O' Use the locale's number symbols.
For example, to produce full ISO 8601 format, use "%FT%T%z".
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment