LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-19-2007, 11:17 PM   #1
tmaxx
LQ Newbie
 
Registered: Jun 2006
Posts: 21

Rep: Reputation: 15
previous day date display script


hi all

does anyone have a script which when executed displays the previous day date?

thanks in advance
 
Old 04-20-2007, 12:30 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

It's not a script, but this will fill a variable with yesterday's date:

YESTERDATE=`TZ=CST+24 date +%Y%m%d`

Shouldn't be to hard to implement that in a script

If the date layout is not to your liking, take a look at man date for other possibilities.

Hope this helps.
 
Old 04-20-2007, 12:50 AM   #3
tmaxx
LQ Newbie
 
Registered: Jun 2006
Posts: 21

Original Poster
Rep: Reputation: 15
thank you sir...
 
Old 04-20-2007, 01:20 AM   #4
rhoekstra
Member
 
Registered: Aug 2004
Location: The Netherlands
Distribution: RedHat 2, 3, 4, 5, Fedora, SuSE, Gentoo
Posts: 372

Rep: Reputation: 42
Or perhaps:

$ date --date="yesterday" +%Y%m%d

Last edited by rhoekstra; 04-20-2007 at 01:21 AM.
 
  


Reply

Tags
date



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Add Date (day) to Filename greengrass Programming 1 01-15-2007 06:48 PM
Can you restore a cron from previous day? Rustylinux SUSE / openSUSE 1 01-15-2007 05:07 PM
Setting to a previous date pwnd Linux - Newbie 5 07-13-2006 03:12 AM
Script to change date in filename minus one day ft77 Linux - General 3 06-02-2006 09:56 AM
date command getting previous day swinchen Programming 6 08-23-2004 12:17 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration