Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying today's date?

Status
Not open for further replies.

stu78

Programmer
May 29, 2002
121
GB
Hi,

Does anyone know a command to modify today's date in c shell? Basically I need to find todays date & subtract 4 from it....

Any Ideas?

Thanks.
Stewart.
 
Hi,
There is a FAQ about how to find yesterday's date.

faq80-953

using this technique you can just change the +24 to +96 and get the date from 4 days ago.
 
Thanks tdatgod,

However this technique uses the Bourne Shell, I am using the C-Shell.

Thanks,
Stu.
 
XI Commendment: "Thou shall not use C-shell for thy scripting"
 

I program CSH as well but I have learned to translate

#!/usr/bin/sh
TZ="$TZ+24"
export TZ
day=`date +%m/%d/%y`
echo $day

----

#!/bin/csh

@ x = $TZ + 24
setenv TZ $x
day=`date +%m/%d/%y`
echo $day



Again change the 24 to 96.


----

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top