Get day before yesterday's and yesterday's date.

Get day before yesterday's and yesterday's date.

Post by Ed Morto » Thu, 16 Dec 2004 23:20:26




> Hello all,

> I am new to Unix. I have to write a shell script which will use
> yesterday's and day before yesterday's date to do some processing
> related to log files. I want the dates in yymmdd format. I know it is
> possible to get today's date in yymmdd format as `date +%y%m%d` but I
> don't know how to get yesterday's and day before yesterday's date
> from this. The script should be generic since in future there might be
> a requirement to get date - n where n can be any number. Any help will
> be appreciated.

Se question 6 in the FAQ (http://home.comcast.net/~j.p.h/cus-faq.html#G).

        Ed.

Quote:> Thanks and Regards,
> Anup Mahajan

 
 
 

Get day before yesterday's and yesterday's date.

Post by Anup Mahaj » Thu, 16 Dec 2004 22:03:33


Hello all,

I am new to Unix. I have to write a shell script which will use
yesterday's and day before yesterday's date to do some processing
related to log files. I want the dates in yymmdd format. I know it is
possible to get today's date in yymmdd format as `date +%y%m%d` but I
don't know how to get yesterday's and day before yesterday's date
from this. The script should be generic since in future there might be
a requirement to get date - n where n can be any number. Any help will
be appreciated.

Thanks and Regards,
Anup Mahajan

 
 
 

1. Calculating yesterday's date using GNU 'date' (was Re: Require a script)

Using GNU 'date':

$ date --date '1 years 2 days ago'
Sun Sep 19 20:14:53 CEST 1999

The GNU 'date' command comes with the GNU 'sh-utils' package available
on all GNU FTP mirrors.

/A

--
Andreas K?h?ri, <URL:http://hello.to/andkaha/>. Junk mail, no.
------------------------------------------------------------------------
What part of "GNU" did you not understand? <URL:http://www.gnu.org/>

2. Still can't ping - Network Unreachable

3. Korn shell date cmd - getting yesterday's date

4. Sed or awk ?

5. Getting Yesterday's Date

6. kppp - pppd has died

7. Get "date '+%y%m%d'" for yesterday?

8. Hacked? odd /bin/login on webserver.

9. >>Get "date '+%y%m%d'" for yesterday?

10. Yesterday's Date

11. How do I get yesterday's date?

12. Return yesterday's date