Web lists-archives.com

Re: Adding Date & Time to a script's output log




On Thu, Jun 01, 2017 at 06:49:58PM +0000, davidson@xxxxxxxxxxxx wrote:
> If you go this convenient-lexical-order route, note that %F is
> shorthand for %Y-%m-%d

Not portable.  See
<http://pubs.opengroup.org/onlinepubs/9699919799/utilities/date.html>

And yeah, this is a Debian mailing list, but there's no compelling
reason to use an obtuse %F option that you'd have to rewrite for other
systems when it doesn't increase readability over %Y-%m-%d which
everyone can easily understand.

Fun with non-Debian systems:

imadev:~$ date +%F
June
imadev:~$ gdate +%F
2017-06-01

(%F is listed as "Obsolescent" on this system; the man page says to use
%B instead.  gdate is GNU date, compiled from sh-utils source long ago.
Before it became part of GNU coreutils.)