I want to get the date information with this command:
but it shows this error:
date: invalid date ‘2019-03-22’
date: invalid date ‘2019/03/22’
as you can see it is not related to dash. the same thing happens with slash.
When I use another date like
It shows the information correctly.
It shouldn't be related to the bad dash character. because I just deleted the last
2 and replaced it with
1 and the output is OK.
What is going wrong?
Result of some commands for more information:
$ date --version date (GNU coreutils) 8.28 Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by David MacKenzie.
$ type -a date date is /bin/date
$ uname -m x86_64
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic
$ which date /bin/date
$ apt-cache policy coreutils coreutils: Installed: 8.28-1ubuntu1 Candidate: 8.28-1ubuntu1 Version table: *** 8.28-1ubuntu1 500 500 http://us.archive.ubuntu.com/ubuntu bionic/main amd64 Packages 100 /var/lib/dpkg/status
$ date Fri Mar 22 06:54:59 PDT 2019
date --date=2019-03-22 2>&1 | od -c 0000000 d a t e : i n v a l i d d a 0000020 t e 342 200 230 2 0 1 9 - 0 3 - 2 2 0000040 342 200 231 \n 0000044
Something weird going on with different timezone in this date:
2019-03-22. I randomly changed timezone to different areas. Some of them have errors, some of them not! When I select these I have problem with that specific date:
- Los Angeles (USA)
- Shanghai (China)
- Madrid (Spain)