|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
|
#2
|
|||
|
|||
|
What languages, shells and environments do you have access to?
|
|
#3
|
|||
|
|||
|
Shell or c shell which ever one will work the best
|
|
#4
|
|||
|
|||
|
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! |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Date Help |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|