User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 375,202 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,379 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser:
Views: 737 | Replies: 3
Reply
Join Date: Aug 2007
Posts: 26
Reputation: programmer321 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
programmer321 programmer321 is offline Offline
Light Poster

Shell Script for yesterday's date.

  #1  
May 8th, 2008
Can any one guie me how to find yesterday's date (taking care of the leap years as well)in the format yymmdd using a shell script. 

Regards.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Mar 2008
Posts: 25
Reputation: blater is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
blater's Avatar
blater blater is offline Offline
Light Poster

Re: Shell Script for yesterday's date.

  #2  
May 8th, 2008
The gnu version of the "date" command (as used in linux/cygwin) has this functionality built in already.

If you are using linux you can simply use
      date --date=yesterday +%y%m%d

See man date for more details.
Last edited by blater : May 8th, 2008 at 8:11 am.
Reply With Quote  
Join Date: Aug 2007
Posts: 26
Reputation: programmer321 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 0
programmer321 programmer321 is offline Offline
Light Poster

Re: Shell Script for yesterday's date.

  #3  
May 8th, 2008
Thanks Blater. It worked. 
Reply With Quote  
Join Date: Oct 2007
Posts: 247
Reputation: eggi is on a distinguished road 
Rep Power: 1
Solved Threads: 26
eggi eggi is offline Offline
Posting Whiz in Training

Re: Shell Script for yesterday's date.

  #4  
May 8th, 2008
Hey there,

If you're interested, just for kicks, here's the long convoluted way to do it

http://linuxshellaccount.blogspot.co...to-remind.html

Cheers,

Mike
Linux and Unix Tips, Tricks and Individual Advice - The Linux and Unix Menagerie!
------------------------------------------------------------------------
Having trouble passing cert exams? Check out How To Pass Any Computer Certification Test!
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Shell Scripting Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Shell Scripting Forum

All times are GMT -4. The time now is 2:44 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC