[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: date bug
From: |
Assaf Feuerstein |
Subject: |
RE: date bug |
Date: |
Thu, 1 Jun 2006 10:53:40 +0200 |
Works great, thank you for your assistance.
With Best Regards
Assaf Feuerstein
Unix System Administrator
Bezeq International
-----Original Message-----
From: Andreas Schwab [mailto:address@hidden
Sent: Wednesday, May 31, 2006 11:58 PM
To: Assaf Feuerstein
Cc: address@hidden
Subject: Re: date bug
"Assaf Feuerstein" <address@hidden> writes:
> As you can see the 1 month ago give me the current month instead of
> last month, and the 2 month ago give me an ok result.
> Is there a way to fix the 1 month ago that it will also work in the
> last day of the month?
Please read the section "Relative items in date strings" in the coreutils
manual:
The fuzz in units can cause problems with relative items. For
example, `2003-07-31 -1 month' might evaluate to 2003-07-01, because
2003-06-31 is an invalid date. To determine the previous month more
reliably, you can ask for the month before the 15th of the current
month. For example:
$ date -R
Thu, 31 Jul 2003 13:02:39 -0700
$ date --date='-1 month' +'Last month was %B?'
Last month was July?
$ date --date="$(date +%Y-%m-15) -1 month" +'Last month was %B!'
Last month was June!
Andreas.
--
Andreas Schwab, SuSE Labs, address@hidden SuSE Linux Products GmbH,
Maxfeldstraße 5, 90409 Nürnberg, Germany PGP key fingerprint = 58CA 54C7 6D53
942B 1756 01D3 44D5 214B 8276 4ED5 "And now for something completely
different."
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- RE: date bug,
Assaf Feuerstein <=