Title: Yesterday date
Author: Sandro Tosi
Last modified: 2005-08-13
To obtain the yesterday date, type
$ date -d '1 day ago'
you can even format it with:
$ date -d '1 day ago' '+%y%m%d'
If you use other numbers, instead of 1, you can go further back in
time:
$ date -d '365 day ago'
it's today a year ago.
Because I've had to generate yesterday date even on AIX systems, I'll
type here the solution for that o.s. too:
$ ksh TZ=<time_zone>+24 date
this way you tell the ksh that the time is 24 hours ahead, so date
will print the correct (for it) date, hence yesterday.
|