Connecting Tech Pros Worldwide Help | Site Map

Previous date in UNIX

  #1  
Old June 18th, 2009, 08:58 AM
Member
 
Join Date: Apr 2009
Posts: 36
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
  #2  
Old June 18th, 2009, 12:05 PM
ashitpro's Avatar
Expert
 
Join Date: Aug 2007
Posts: 388

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
  #3  
Old July 7th, 2009, 03:31 PM
Member
 
Join Date: Apr 2009
Posts: 36

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to use obfucation in .NET JustinC answers 10 June 26th, 2006 03:55 PM
DB2 date format issue Dario Di Bella answers 6 November 12th, 2005 08:53 AM
[perl-python] find & replace strings for all files in a dir Xah Lee answers 1 July 18th, 2005 09:55 PM
Sort by time (hh:mm:am/pm - format) in text string 00steve answers 5 July 17th, 2005 07:41 AM