From: Bob Vickers <bobv@dcs.rhbnc.ac.uk>
Subject: Re: Date Calculations
Date: 1998/11/13 [thread overview]
Message-ID: <364C1C1F.A360E959@dcs.rhbnc.ac.uk> (raw)
In-Reply-To: 71vm9f$blh$1@newsreader4.core.theplanet.net
Richard Mayes wrote:
>
> Bob Vickers wrote in message <3638A5FB.2A015FD7@dcs.rhbnc.ac.uk>...
> >Mr Mayes wrote:
> >>
> >> >>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.
> >> >
> >>
> >> It should be simple enough using the TZ environment variable.
> >>
> >> TZ=GMT168 date +"+"%d-%b-%y" ought to do the job.
> >>
> >
> >Well it doesn't work on DU 4.0B, and you haven't really any right to
> >expect it to work. You should either get hold of the GNU date program or
> >do it in Perl.
> >
> >Bob
>
> You're spot on Bob. This does not work in DU 4. At least not beyond 48
> hours. It's a shame really as this is a natty little feature that is
> available on all other flavours of Unix that I have been involved with.
>
> Incidentally why have I no right to expect it to work ? It seems slightly
> odd logic to suggest that I shouldn't expect a normal Unix facility to work
> whilst putting forward alternatives that are not part of a standard
> commercial Unix distribution.
>
Rich,
I think you are confusing a 'feature' with an accident of
implementation. You can only describe something as a feature if it is
defined in a manual somewhere. The TZ variable is defined in the tzset
man page, and it explicitly states that the hour offset is between 0 and
24. It is the same on Linux and Solaris (see environ(5) man page).
So the behaviour on these systems for an hour of 168 is undefined. You
might get lucky and find it behaves in the way you want, but there is no
guarantee it will work tomorrow, or after you upgrade or switch to
another operating system.
Bob
--
======================================================================
Bob Vickers R.Vickers@dcs.rhbnc.ac.uk
Dept of Computer Science, Royal Holloway College, University of London
WWW: http://www.cs.rhbnc.ac.uk/home/bobv
Phone: +44 1784 443691
next prev parent reply other threads:[~1998-11-13 5: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
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 [this message]
-- 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