From: weber@NOSPAM.bucknell.edu (Chris Weber)
Subject: Re: Date Calculations
Date: 1998/10/09 [thread overview]
Message-ID: <weber-0910980827040001@megmodem.bucknell.edu> (raw)
In-Reply-To: 6vju3c$emk$1@newsflash.concordia.ca
In article <6vju3c$emk$1@newsflash.concordia.ca>, smw@trm.concordia.ca (
Steven Winikoff ) wrote:
>In <6v2mt1$74e$1@nnrp1.dejanews.com> lloydy1090@my-dejanews.com writes:
>
>>I want to be able to set a variable to the current date minus 7. I'm using
>>date +"%d-%b-%y"to return the current date and I want to be able to return
>>the same format for 1 week ago.
>
>I don't have *exactly* what you're looking for, but I have two
>suggestions that come fairly close.
>
>First of all, there's a program called "calcdate" in Volume 3, Issue 22
>of comp.sources.misc. AltaVista reports a copy at
>
> http://ftp.doc.ic.ac.uk/packages/unix-c/calendars/calcdate.c.gz
GNU _date_ can do this via its "-d" flag, used to tell _date_ what time
to pretend it is. The syntax accepted by "-d" is quite flexible.
To have GNU _date_ return what you require, you could incant:
$ date -d "-7days" +%d-%b-%y
GNU _date_ is part of the GNU Shell Utilities package, which can be found at:
ftp://ftp.gnu.org/pub/gnu/sh-utils-1.16.tar.gz
--
Chris Weber <weber@NOSPAM.bucknell.edu>
Bucknell Computer and Communication Services
next prev parent reply other threads:[~1998-10-09 4:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-10-02 4:00 Date Calculations lloydy1090
1998-10-09 4:00 ` Steven Winikoff
1998-10-09 4:00 ` Chris Weber [this message]
1998-10-19 4:00 ` Mr Mayes
1998-10-29 5:00 ` Bob Vickers
1998-11-06 5:00 ` Richard Mayes
1998-11-13 5:00 ` Bob Vickers
-- strict thread matches above, loose matches on Subject: below --
1996-05-14 4:00 Robert Reed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox