displaying date

Hi All,

When I type date..I get the date, time ..etc displayed
...but can someone help me to display yesterdays date... some script to display back dates.

Thanks in advance

Minaz

See this post for the info you are looking for.

Thanx RTM !!!

Isn't there any OS built system utility e.g. something like "sysdate"

Also I chked the post u suggested.
Another query --- When I type

# date
Wed Nov 13 13:54:09 CST 2002
#d=`TZ=a30 date +%a' '%b' '%e' '%T' '%Z' '%Y`
#echo $d
Tue Nov 12 13:54:38 a 2002

Now, Can you pls. help me how to display the Time Zone properly.

Regds,
Minaz

There is not a sysdate in UNIX.

As far as your command, why are you setting the TZ and where are you getting the information? This is the portion that is incorrect.

(fyi - you don't need all those quotes)
$ d=`date +'%a %b %e %T %Z %Y'`
$ echo $d
Wed Nov 13 15:55:37 EST 2002

What Unix are you using?
There may be a different answer if you're on Linux or if you have GNU Date installed...

I did it another way. Put a cron to run at 2315 daily to create a file with yesterday's date in whatever format u need. ANd read the file when u want. It is not the most elegant solution but it works for me!!

I'm using SunOS 5.7
RTM - Thanx for the " quotes thing " but after setting TZ=a30, I get yesterday's date. Similarly I dont just want yesterday's date..it can be any number of days back.

Just for additional knowledge, if u can help me out with the timezone error then it would be great.

Anyways, i got a script which converts the date to any number of days back.

Thanx all for ur replies.

Minaz

Buddies, .............. Its done !!!

[/home]d=`TZ=CST30 date +'%a %b %e %T %Z %Y'`
[/home]echo $d
Wed Nov 13 09:59:20 CST 2002
[/home]date
Thu Nov 14 09:59:30 CST 2002

Thanx

Minaz