epike on Mon, 25 Mar 2002 20:50:19 +0100


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Shell script quickie: yesterday's date


after typing around I'm surprised that this actaully worked:

localhost.localdomain[119]% date --date=now
Mon Mar 25 14:40:01 EST 2002
localhost.localdomain[120]% date --date=yesterday
Sun Mar 24 14:40:05 EST 2002
localhost.localdomain[121]% 

localhost.localdomain[121]% date --date=yesterday +%Y%m%d
20020324
localhost.localdomain[122]% 

e pike

> 
> For you shell scripting wizards out there...  I need a script that will
> simply echo yesterday's date.  This should be according to local time,
> not GMT.  For example, if run today, it should simply echo "20020324". 
> I've been playing with the 'date' command, and `date +%Y%m%d` gives
> exactly what I want, except with today's date.  I think the '-d' option
> is useful, but I'm not sure what the argument should be. 
> 
> Ah, it feels good to be back on PLUG, with my mail server now running
> debian...  Goodbye, rpm dependencies! 
> 
> Michael F. Robbins 
> mike@gamerack.com
> 


______________________________________________________________________
Philadelphia Linux Users Group       -      http://www.phillylinux.org
Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce
General Discussion  -  http://lists.phillylinux.org/mail/listinfo/plug