You are not logged in.
Hello everyone,
I have a funny little problem with the 'date' command. I have two machines with arch installed on it. On one of them I can run the following command without any problems:
% date -d "$(date)"which returns me the current date. Running the same command on another machine with the same bash/zsh/locale/... configuration (both machines are updated) returns me an error:
% date -d "$(date)"
date: invalid date ‘...’I cannot grasp what could cause such a behaviour...
Any advice and help are appreciated.
Last edited by e.sovetkin (2015-11-11 12:19:40)
Offline
Seems to be locale dependent on my machine:
% date -d "$(date)"
date: invalid date ‘Mi 11. Nov 13:08:32 CET 2015’
% date -d "$(LC_ALL=C date)"
Mi 11. Nov 13:08:50 CET 2015% locale
LANG=en_US.utf8
LC_CTYPE="en_US.utf8"
LC_NUMERIC=de_DE.UTF-8
LC_TIME=de_DE.UTF-8
LC_COLLATE="en_US.utf8"
LC_MONETARY=de_DE.UTF-8
LC_MESSAGES="en_US.utf8"
LC_PAPER=de_DE.UTF-8
LC_NAME=de_DE.UTF-8
LC_ADDRESS=de_DE.UTF-8
LC_TELEPHONE=de_DE.UTF-8
LC_MEASUREMENT=de_DE.UTF-8
LC_IDENTIFICATION=de_DE.UTF-8
LC_ALL=I put at button on it. Yes. I wish to press it, but I'm not sure what will happen if I do. (Gune | Titan A.E.)
Offline
Indeed, thanks for the quick reply!
The difference was in locale in en_US and en_GB, and setting LC_ALL=C solves the problem.
I shall be aware of these locale setting in scripts now!
Seems to be locale dependent on my machine:
% date -d "$(date)" date: invalid date ‘Mi 11. Nov 13:08:32 CET 2015’ % date -d "$(LC_ALL=C date)" Mi 11. Nov 13:08:50 CET 2015% locale LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC=de_DE.UTF-8 LC_TIME=de_DE.UTF-8 LC_COLLATE="en_US.utf8" LC_MONETARY=de_DE.UTF-8 LC_MESSAGES="en_US.utf8" LC_PAPER=de_DE.UTF-8 LC_NAME=de_DE.UTF-8 LC_ADDRESS=de_DE.UTF-8 LC_TELEPHONE=de_DE.UTF-8 LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=de_DE.UTF-8 LC_ALL=
Offline