Correct. So if you really want something that will work for all dates,
including first of month, first of month in March on leap and nonleap
year, first of year, etc. you need something else.
I'm not enough of a UNIX authority to know if this is standard for all
implementations of the UNIX date command and can't test in z/OS
environment, but a search for "relative dates" and "Linux" found a
"--date" parameter for the "date" command. At least on Fedora Linux the
date command already appears to have relative date calculation built in.
Currently (2013-03-14) on Fedora the command
date --date="14 days ago"
returns "Thu Feb 28 09:52:21 CST 2013"
and
date --date="379 days ago"
returns "Wed Feb 29 09:57:26 CST 2012"
If "date" under z/OZ UNIX supports the same parameters, then
date +%Y%m%d --date="1 day ago"
which today on Fedora returns "20130313" may be the form you need.
JC Ewing
On 03/14/2013 08:32 AM, Uwe Oswald wrote:
Thx perfect, thats exactly what I need. But I'm afraid this doesn’t work for
the first of a month for example 20130401 will then be 20130400 or I'm wrong?
-----Ursprüngliche Nachricht-----
Von: IBM Mainframe Discussion List [mailto:[email protected]] Im Auftrag
von Rafal Hanzel ZETO Katowice
Gesendet: Donnerstag, 14. März 2013 13:23
An: [email protected]
Betreff: Re: USS "date" command, subtract one day
Maybe something like that, will help you:
echo "`date +%Y%m%d` - 1" | bc
---
Pozdrawiam/Best regards,
Rafal Hanzel
Programista systemowy, Dział Badań i Rozwoju Systemów Komputerowych Tel. +48 32
3589246, Fax +48 32 3589277, email: [email protected] Tel. kom. +48
501677656 Zakład Elektronicznej Techniki Obliczeniowej w Katowicach Spółka z
o.o.
40-158 Katowice, ul. Owocowa 1
Sąd Rejonowy Katowice - Wschód w Katowicach Wydział VIII Gospodarczy Krajowego
Rejestru Sądowego, KRS 0000051477 Kapitał zakładowy: 264500 zł NIP
634-013-11-06 http://www.zetokatowice.pl
Jesteśmy uczestnikiem Programu
RZETELNA Firma
Sprawdź naszą rzetelność na
http://www.rzetelnafirma.pl/8FGKEVFH
Treść tej informacji może być poufna, w związku z czym powinna trafić
bezpośrednio do rąk adresata. Jakiekolwiek jej ujawnianie, rozpowszechnianie,
bądź kopiowanie jest zabronione. W przypadku omyłkowego otrzymania niniejszej
informacji prosimy o poinformowanie nadawcy i usunięcie jej z komputera.
W dniu 14.03.2013 12:54, Uwe Oswald napisał(a):
Hi,
I dont know if this is the right forum but I hope someone could help
anyway. I want to subtract "one day" from the actual date with one USS
unix command.
The actual date I get via "date +%Y%m%d" (for example 20130314), but
"date +%Y%m%d-1" or "...yesterday" don’t work. I have tried everything
without success. Does anybody have a tip for me? It must be achieved
within one command not more.
Thx
Uwe
--
Joel C. Ewing, Bentonville, AR [email protected]
----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN