LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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-04-2006, 12:14 PM   #1
newbie_adm
Member
 
Registered: Jun 2006
Posts: 40

Rep: Reputation: 15
current date - yesterday's date


Hi!! I have created a script that will calculate or show that statistics of call every hour. My problem is that the file that I'm going to read for processing the stats is delayed. So when I have to get the stats on 11PM and the script runs on 12:30 it reads nothing since the posting of file is 30 mins late(Sorry If I can't explain this cleary). All I wnated is to get the time from 11PM to 1159 PM the other day even if I run the script at 12:30 of the present day. How will I subtract the one day from the current time. I have just declared a varibale of date. Please help me on this one.

Best regards,
newbie_adm
 
Old 09-04-2006, 12:24 PM   #2
newbie_adm
Member
 
Registered: Jun 2006
Posts: 40

Original Poster
Rep: Reputation: 15
By the way.This is how I declare my date on my script. I wanted to get the date and time(11:00PM) of the prevous day. Scripts is run on the present day at 12:30 AM.

DATE1=`date '+%Y-%m-%d23'`
 
Old 09-04-2006, 12:31 PM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
date --date="1 day ago"
 
Old 09-04-2006, 12:38 PM   #4
newbie_adm
Member
 
Registered: Jun 2006
Posts: 40

Original Poster
Rep: Reputation: 15
Can I retain the same format date That I have declared awhile ago? Can it is the format of the date of the file that my script is going to read.
 
Old 09-04-2006, 03:56 PM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,944
Blog Entries: 54

Rep: Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731Reputation: 2731
Can I retain the same format date That I have declared awhile ago?
You mean you didn't even bother to *test* combining those arguments?
 
  


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
How do I add the current date to a filename? sammysrefuge Linux - Newbie 2 03-18-2005 02:43 PM
Setting environment variable to current date/time nafan Programming 1 08-23-2004 09:04 PM
Figuring out yesterday's date within a script chrisk5527 Linux - General 1 02-04-2003 04:47 PM
Appending current date and time to a file frankietomatoes Linux - General 5 11-18-2002 02:09 PM
lastlog date does not match system date? jcmj Linux - Networking 6 10-22-2002 12:09 PM


All times are GMT -5. The time now is 10:31 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration