On 05/02/18 00:43, Nicolas George wrote: > Richard Hector (2018-02-05): >> #389251 (coreutils: date's -d switch doesn't honour locale) - it's quite >> an old one. But I found another instance in which the same claim applies: >> >> richard@zircon:~$ date -d '4/2/2018' >> Mon Apr 2 00:00:00 NZST 2018 >> >> In my NZ locale, that date should be interpreted as 4 Feb. > > I would have to agree with coreutils: localizing parsing is an > aberration that should never have been implemented, and it is a good > thing that we progressively get rid of it. > > Anecdote: more than 15 years ago, with some locales, if you were to call > gtk_init() from the OCaml interactive interpreter, and then issue "let > pi = 3.14;;", you would get "pi = 3.0", because gtk_init() would have > initialized locales and made the decimal separator a comma. > > Never ever use "DD/MM/YYYY", "DD-MM-YYYY", "MM-DD-YYYY" nor > "MM/DD/YYYY". If your output is intended for humans, print your month > names; if your output is intended for computers, use the only logical > order: YYYY-MM-DD. It is standardized and understood by coreutils. In which case, it should refuse to accept '4/2/2018' at all, right? I almost always uses YYYY-MM-DD, except when filling in a form with spaces provided - in which case I'll write (eg) 'Feb' in the month space, to avoid ambiguity. Richard
Attachment:
signature.asc
Description: OpenPGP digital signature