Connecting Tech Pros Worldwide Forums | Help | Site Map

Previous date in UNIX

Member
 
Join Date: Apr 2009
Posts: 36
#1: Jun 18 '09
Hi All,

Could someone pls let me know how to get preiousday for the current date.

Y i require this because i my script runs it will genate reports and sent them via mail, and in subject to include date.

And the problem is when these reports failed if we run these reports next day the subect line will current day actually we are ruuning reports for previous day.

Could some one pls help me out from this...

Cheers
harsha

ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 389
#2: Jun 18 '09

re: Previous date in UNIX


Quote:

Originally Posted by harshakusam View Post

Hi All,

Could someone pls let me know how to get preiousday for the current date.

Y i require this because i my script runs it will genate reports and sent them via mail, and in subject to include date.

And the problem is when these reports failed if we run these reports next day the subect line will current day actually we are ruuning reports for previous day.

Could some one pls help me out from this...

Cheers
harsha

This is I got when I run few commands...
$date
Thu Jun 18 07:04:38 EDT 2009

$date -d "-1 day"
Wed Jun 17 07:04:46 EDT 2009

This should help you
Member
 
Join Date: Apr 2009
Posts: 36
#3: Jul 7 '09

re: Previous date in UNIX


This is how you get previous date.. :---)

newprd$ echo `date`
Tuesday, 7 July 2009 15:30:19 BST
newprd$ echo `TZ=CST+24 date +%d/%m/%y`
06/07/09
Reply