]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
doc: more date +%F clarifications
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 Feb 2019 18:20:23 +0000 (10:20 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 25 Feb 2019 18:21:07 +0000 (10:21 -0800)
* 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.

doc/coreutils.texi
src/date.c

index 3eedd3c63e43a5b853b293fab027dad144205567..eb18488829dcc8a42c2bab777a689a6a997e9fe7 100644 (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
index 6904eeadb104c72893914973622f8fb213ff5960..d97d0ae52c08d934128e42f70e87691809f62bb2 100644 (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);