Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
Error command DATE
Error command DATE
Good night.
When executing the syntax below returns error, however if I put day 02 or 04 it works out. Only with day 03 that gives error.
date -d "20191103" +% d% m% Y
I tested in Debian 9 and Ubuntu 18.04, both have the same error, but when run in OpenSuse 12.3 it works!
can you help me?
Thank you very much in advance.
When executing the syntax below returns error, however if I put day 02 or 04 it works out. Only with day 03 that gives error.
date -d "20191103" +% d% m% Y
I tested in Debian 9 and Ubuntu 18.04, both have the same error, but when run in OpenSuse 12.3 it works!
can you help me?
Thank you very much in advance.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
You say both have the same error, but what is the error, what does it say ?
Debian is not Opensuse, neither is Ubuntu, so it is logical that a command that works on opensuse might not work on either other distro.
Also, for Debian, see the manual for date:
Your operands don't look right to me, the error message should clarify on that, but you do not show it.
Also it really is not clear what you are trying to do,
what output you expect or want,..
Here is one example:
Or is this what you want ?
Or this :
Do you need more examples ?:
======
You can try even more various methods, and see what the out put is, if none of the above are what you want.
To sum it up, the syntax that you claim works on opensuse, will not work on Debian, ... But yes, even on Debian, one can get the output with 03, as the day,..if they take the time to read a little, ...I did not know the answer when I started, but a quick search, and a few trial by error, combined with reading the manual, ...just goes to show.
I am not familiar with opensuse, but I find it hard to believe that syntax even works on opesuse.
Debian is not Opensuse, neither is Ubuntu, so it is logical that a command that works on opensuse might not work on either other distro.
Also, for Debian, see the manual for date:
Code: Select all
man date
Also it really is not clear what you are trying to do,
what output you expect or want,..
Here is one example:
Code: Select all
garry@debian:~$ date -d "20191103" "+%d%m%y"
031119
garry@debian:~$
Code: Select all
garry@debian:~$ date -d "20191103" "+%y%m%d"
191103
garry@debian:~$
Code: Select all
garry@debian:~$ date -d "20191103" "+%Y%m%d"
20191103
garry@debian:~$
Code: Select all
garry@debian:~$ date -d "20191103" "+ %d %m %Y"
03 11 2019
garry@debian:~$
Code: Select all
garry@debian:~$ date -d "20191103" "+ %D %M %Y"
11/03/19 00 2019
garry@debian:~$
To sum it up, the syntax that you claim works on opensuse, will not work on Debian, ... But yes, even on Debian, one can get the output with 03, as the day,..if they take the time to read a little, ...I did not know the answer when I started, but a quick search, and a few trial by error, combined with reading the manual, ...just goes to show.
I am not familiar with opensuse, but I find it hard to believe that syntax even works on opesuse.
Last edited by GarryRicketson on 2019-05-24 02:33, edited 1 time in total.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
Additional :
I really don't believe the above would work on opensuse either, and that kind of makes me wonder,... so Can any Opensuse users confirm ? Is that really a correct syntax on Opensuse ? Just wondering
It does not and can not work as you show it, and it does not matter if you use 02,04, etc, it is just plain bad syntax, as the error messages show,Post by elkergb » 2019-05-23 18:51
Good night.
When executing the syntax below returns error, however if I put day 02 or 04 it works out. Only with day 03 that gives error.
date -d "20191103" +% d% m% Y
I tested in Debian 9 and Ubuntu 18.04, both have the same error, but when run in OpenSuse 12.3 it works!
can you help me?
Code: Select all
garry@debian:~$ date -d "20191104" +% d% m% Y
date: extra operand ‘d%’
Try 'date --help' for more information.
garry@debian:~$ date -d "20191102" +% d% m% Y
date: extra operand ‘d%’
Try 'date --help' for more information.
garry@debian:~$
Re: Error command DATE
Simply you can't print something to standout that's not there i/e something% can't work. Needs to be %something because something is in memory.
TC
TC
You can't believe your eyes if your imagination is out of focus.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
Thanks, but it seems the OP claims they can on opensuse,
Any way, variations of the 'date' command all work just fine on Debian, if the syntax is written correctly.
I think maybe they are "pulling our leg", as they say.....I don't think it works on opensuse, either. In fact, now that I think about it, Why did the OP even mention opensuse, if they really are trying to get help with Debian ?elkergb » but when run in OpenSuse 12.3 it works!
Any way, variations of the 'date' command all work just fine on Debian, if the syntax is written correctly.
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Error command DATE
When I put the message in Translator she misconfigured the syntax, so I'm sending the prints. In summary, converting to Debin / Ubuntu gives error, but in Opensuse not. Only one specific day as you can see on the prints.
Answering some colleagues:
- The error that appears is "Invalid Date"
- syntax works on all the above distributions
Peço desculpas se novamente o tradutor não funcionar.
Answering some colleagues:
- The error that appears is "Invalid Date"
- syntax works on all the above distributions
Peço desculpas se novamente o tradutor não funcionar.
- Attachments
-
- print_opensuse.png (26.13 KiB) Viewed 11468 times
-
- print_ubuntu.png (22.69 KiB) Viewed 11468 times
-
- print_debian.png (18.22 KiB) Viewed 11468 times
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
Thank you for the additional info, and clarifying.
This seems strange to me, I can not duplicate it :
As you can see , I don't get the error, Can you please show us the out put from ? :
Just the Debian, the other distros are of no importance. I have no idea why on your system the command does not work as it should, it does on mine, but that does not mean there is not some kind of problem, maybe it only effects certain hardware, IE: PC, keyboard, etc,...
=== edit ====
Also, are you trying to set the date and time, ? or Why are you needing this date format to say ?
This seems strange to me, I can not duplicate it :
Code: Select all
garry@debian:~$ date -d"20191103" +%d/%m/%Y
03/11/2019
garry@debian:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux buster/sid
Release: testing
Codename: buster
garry@debian:~$ uname -a
Linux debian 4.19.0-4-amd64 #1 SMP Debian 4.19.28-2 (2019-03-15) x86_64 GNU/Linux
garry@debian:~$
Code: Select all
lsb_release -a
=== edit ====
Also, are you trying to set the date and time, ? or Why are you needing this date format to say
Code: Select all
03/11/2019
"What we expect you have already Done"
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
==========
Old Website
======================
For the Birds
==================
What Does a Parrot Know About PTSD?
Re: Error command DATE
Also run echo $0 and let us know what shell is in use when you get the error. I've seen errors because of shell resets, but never like this. I can't duplicate it on stable.
TC
TC
You can't believe your eyes if your imagination is out of focus.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
I had not noticed earlier, but the OP is using a older kernel version, based on the "uname" out put, so that kind of explains why I can't duplicate it.
- None1975
- df -h | participant
- Posts: 1410
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 46 times
- Been thanked: 70 times
Re: Error command DATE
And i don't get the error:
My shell is zsh
Code: Select all
date -d"20191103" +%d/%m/%Y
03/11/2019
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.9 (stretch)
Release: 9.9
Codename: stretch
uname -a
Linux jwm 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u2 (2019-05-13) x86_64 GNU/Linux
Code: Select all
echo $SHELL
/bin/zsh
OS: Debian 12.4 Bookworm / DE: Enlightenment
Debian Wiki | DontBreakDebian, My config files on github
Debian Wiki | DontBreakDebian, My config files on github
Re: Error command DATE
Code: Select all
trinidad@debianamd1:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 9.6 (stretch)
Release: 9.6
Codename: stretch
trinidad@debianamd1:~$ echo $0
bash
trinidad@debianamd1:~$ uname -a
Linux debianamd1 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux
trinidad@debianamd1:~$ date -d"20191103" +%d/%m/%Y
03/11/2019
trinidad@debianamd1:~$ ps -p "$$"
PID TTY TIME CMD
4547 pts/0 00:00:00 bash
trinidad@debianamd1:~$
TC
You can't believe your eyes if your imagination is out of focus.
Re: Error command DATE
Thinking about this a bit, and I'm not sure if you're serious here, or just playing around, but the SUSE code is in a C shell, though that is no reason why there would be errors in Debian's BASH. Are you running something or building with XML and not switching back shells in Debian? It has to be a shell error, almost like it's a web extension 103 error code without the message. Some software in between is causing the entry to be declared invalid. Make sure your shell in Debian is BASH and run the date command again. It would be nice to identify the cause if possible in case it is an odd bug of some sort.
TC
TC
You can't believe your eyes if your imagination is out of focus.
- Head_on_a_Stick
- Posts: 14114
- Joined: 2014-06-01 17:46
- Location: London, England
- Has thanked: 81 times
- Been thanked: 133 times
Re: Error command DATE
I think the OP is winding us up and has a hidden unicode character in the posted screenshot that is making the command fail.
@OP: disprove me by posting your example in code tags.
@OP: disprove me by posting your example in code tags.
deadbang
Re: Error command DATE
It works just fine in Debian 10 as well, but as indidcated before you need to eliminate the spaces in the formatting parameter:
This produces:
03/11/2019
Code: Select all
date -d "20191103" +%d/%m/%Y
03/11/2019
Re: Error command DATE
@None 1975 $SHELL gives the default shell. $0 gives the current shell.
@HoaS You may right.
@OP Post your output code running the last command as requested.
TC
@HoaS You may right.
@OP Post your output code running the last command as requested.
TC
You can't believe your eyes if your imagination is out of focus.
- GarryRicketson
- Posts: 5644
- Joined: 2015-01-20 22:16
- Location: Durango, Mexico
Re: Error command DATE
Maybe the OP is trying to do some kind of sorcery or cast a witch spell, to confuse and mislead us.