The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Yesterday in i.e. May 09 and 05/09 format Daniel Gate Shell Programming and Scripting 3 05-20-2008 04:59 PM
get yesterday in yyyymmdd format aaron_fong Shell Programming and Scripting 13 03-14-2008 03:14 PM
yesterday Tlg13team Shell Programming and Scripting 0 02-27-2008 04:02 AM
How to show yesterday date wind_n_cloud Shell Programming and Scripting 1 02-16-2005 10:51 PM
get yesterday date in yyyymmdd format hk_newbie UNIX for Dummies Questions & Answers 2 12-14-2001 03:32 PM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 04-21-2004
osymad's Avatar
osymad osymad is offline
Registered User
  
 

Join Date: Sep 2001
Location: Mexico City
Posts: 10
Getting yesterday DATE

Hi
It is possible pass to one program a parameter YESTERDAY DATE , i mean the current date less one day (sysdate -1) ?
  #2 (permalink)  
Old 04-21-2004
google's Avatar
google google is offline Forum Advisor  
Moderator
  
 

Join Date: Jul 2002
Location: Atlanta
Posts: 740
Perderabo wrote a cool date script that will do what you ask and more! Click Here To Get the Script. Use the date_calc script to calculate the date you need then pass it as a parameter to your script. Good Luck.

Last edited by google; 04-21-2004 at 10:18 PM..
  #3 (permalink)  
Old 04-23-2004
djsal djsal is offline
Registered User
  
 

Join Date: Apr 2004
Location: Long Island Ny
Posts: 23
Re: Getting yesterday DATE

Quote:
Originally posted by osymad
Hi
It is possible pass to one program a parameter YESTERDAY DATE , i mean the current date less one day (sysdate -1) ?

I needed that functionality once too, I went about it by appending the current date to a file every day at 23:59 in cron... then refrencing that file whenever I needed to write a script to get things for yesterday... or last 5 days and so on and so forth.

yesterdaysdate=`head -1 $datefile`
past5days=`head -5 $datefile`
  #4 (permalink)  
Old 04-24-2004
oombera's Avatar
oombera oombera is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2002
Location: Cleveland, OH
Posts: 804
Re: Re: Getting yesterday DATE

Quote:
Originally posted by djsal
I needed that functionality once too, I went about it by appending the current date to a file every day at 23:59 in cron... then refrencing that file whenever I needed to write a script to get things for yesterday... or last 5 days and so on and so forth.

yesterdaysdate=`head -1 $datefile`
past5days=`head -5 $datefile`
Interesting work-around; it sounds like you'd end up with a large file in a short amount of time though ... Perderabo's script is worth taking a look at. It has a ton of functionality to it.
  #5 (permalink)  
Old 04-26-2004
tdavis0418 tdavis0418 is offline
Registered User
  
 

Join Date: Jan 2004
Posts: 3
Here is how I get yesterdays date


DATE_STAMP=`TZ=CST+24 date +%y%m%d`
  #6 (permalink)  
Old 07-13-2004
akrahul akrahul is offline
Registered User
  
 

Join Date: Jan 2002
Posts: 2
Getting yesterday's date

Try the following command at your unix prompt:

perl -e 'print localtime(time() - 86400) . "\n" '

If your unix machine has Perl installed, then it will work.
  #7 (permalink)  
Old 09-20-2006
decci_7 decci_7 is offline
Registered User
  
 

Join Date: Sep 2006
Posts: 17
What does CST stands for?

Quote:
Originally Posted by tdavis0418
Here is how I get yesterdays date


DATE_STAMP=`TZ=CST+24 date +%y%m%d`
This works but can you please tell for what we use "TZ" and "CST"???
Sponsored Links
Reply

Bookmarks

Tags
solaris

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 12:25 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0