LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-23-2013, 07:43 AM   #1
shipon_97
Member
 
Registered: Oct 2005
Location: Bangladesh
Posts: 490

Rep: Reputation: 30
Regarding date variable !


Dear Friends ,

I write a script with 'date' format like below :
Date=`date +%d%b%Y`
The output of '$Date' is : 22Sep2013

But I need this Date format which shows the output of the previous day . I mean If today is 22ep3013 , my $Date format gives me output : 21Sep2013 .

How can I produce it, please help ?

Waiting for your kind reply ... ...
 
Old 09-23-2013, 07:51 AM   #2
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,800
Blog Entries: 11

Rep: Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103
solution is at http://www.linuxquestions.org/questi...ar-4175429139/
 
Old 09-23-2013, 07:53 AM   #3
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389Reputation: 2389
Code:
date --date="1 day ago" '+%d%b%Y'
EDIT: Too slow.....
 
Old 09-23-2013, 09:46 PM   #4
Habitual
LQ Addict
 
Registered: Jan 2011
Posts: 7,800
Blog Entries: 11

Rep: Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103Reputation: 2103
Quote:
Originally Posted by druuna View Post
Code:
date --date="1 day ago" '+%d%b%Y'
EDIT: Too slow.....
Maybe, I was pondering tossing out
Code:
date +"%d%b_%Y" --date="1 days ago"
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with variable date miros84 Linux - Newbie 4 01-21-2013 10:58 AM
Problem with loading date into variable boumphreyfr Linux - Newbie 10 05-09-2011 01:27 PM
Need variable for yesterday's date stefaandk Programming 8 01-28-2007 10:50 PM
date variable user52 Linux - Newbie 2 11-28-2006 08:48 AM
Setting environment variable to current date/time nafan Programming 1 08-23-2004 09:04 PM


All times are GMT -5. The time now is 10:02 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration