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. And if you need input from the user, provide a higher-level interface. Regards, -- Nicolas George
Attachment:
signature.asc
Description: Digital signature