UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old April 3rd, 2006, 09:34 AM
dshea0001 dshea0001 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 4 dshea0001 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 51 sec
Reputation Power: 0
Date Help

I need to take the current date and subtract 4 to get the information from the past for days. How do I do this

Reply With Quote
  #2  
Old April 3rd, 2006, 10:23 AM
SimonJM SimonJM is online now
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 762 SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 22 h 8 m 4 sec
Reputation Power: 336
What languages, shells and environments do you have access to?

Reply With Quote
  #3  
Old April 3rd, 2006, 11:30 AM
dshea0001 dshea0001 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2006
Posts: 4 dshea0001 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 25 m 51 sec
Reputation Power: 0
Shell or c shell which ever one will work the best

Reply With Quote
  #4  
Old April 4th, 2006, 07:27 AM
SimonJM SimonJM is online now
Contributing User
Dev Shed Novice (500 - 999 posts) Click here for more information
 
Join Date: Mar 2006
Posts: 762 SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level)SimonJM User rank is Major (30000 - 40000 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 22 h 8 m 4 sec
Reputation Power: 336
If all you have are the various shells then what you are after may be a liitle awkward as they do no tend to offer much (if anything) in the way of date manipulation. With access to mySQL you could use iss date handling, likewise access to other languages like perl.

Still, with shells:

Get the date into a standard format - yyyymmdd (for example) and then break that down into component parts (maybe using cut). Then it is a 'simple' bit of coding to subtract 4 from the number of days, rolling back month and year, if need be.

man pages to look at: date, cut, expr

I am SURE there are far better ways of doing this!

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > Date Help


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT