doc: more date +%F clarifications

* doc/coreutils.texi (Date conversion specifiers):
Plain %F is actually like %+4Y-%m-%d.
(Padding and other flags): Mention POSIX restrictions.
* src/date.c (usage): Document recent changes.
This commit is contained in:
Paul Eggert committed 2019-02-25 10:21:07 -08:00
1 parent d5c820109e
commit 2ab2f7a422
2 files changed
+11 -2

No files matched your search

+9 -1
View File
@@ -15896,7 +15896,9 @@ date; same as @samp{%m/%d/%y}
@item %e
day of month, space padded; same as @samp{%_d}
@item %F
full date in ISO 8601 format; same as @samp{%Y-%m-%d}.
full date in ISO 8601 format; like @samp{%+4Y-%m-%d}
except that any flags or field width override the @samp{+}
and (after subtracting 6) the @samp{4}.
This is a good choice for a date format, as it is standard and
is easy to sort in the usual case where years are in the range
0000@dots{}9999.
@@ -16053,6 +16055,12 @@ applies only to numeric conversion specifiers.
If the format supports the modifier but no alternate representation
is available, it is ignored.
POSIX specifies the behavior of flags and field widths only for
@samp{%C}, @samp{%F}, @samp{%G}, and @samp{%Y} (all without
modifiers), and requires a flag to be present if and only if a field
width is also present. Other combinations of flags, field widths and
modifiers are GNU extensions.
@node Setting the time
@subsection Setting the time
+2 -1
View File
@@ -194,7 +194,7 @@ FORMAT controls the output. Interpreted sequences are:\n\
%e day of month, space padded; same as %_d\n\
"), stdout);
fputs (_("\
%F full date; same as %Y-%m-%d\n\
%F full date; like %+4Y-%m-%d\n\
%g last two digits of year of ISO week number (see %G)\n\
%G year of ISO week number (see %V); normally useful only with %V\n\
"), stdout);
@@ -253,6 +253,7 @@ The following optional flags may follow '%':\n\
- (hyphen) do not pad the field\n\
_ (underscore) pad with spaces\n\
0 (zero) pad with zeros\n\
+ pad with zeros, and put '+' before future years with >4 digits\n\
^ use upper case if possible\n\
# use opposite case if possible\n\
"), stdout);