Works great, thank you for your assistance.

With Best Regards 
 
Assaf Feuerstein
Unix System Administrator
Bezeq International

-----Original Message-----
From: Andreas Schwab [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, May 31, 2006 11:58 PM
To: Assaf Feuerstein
Cc: bug-coreutils@gnu.org
Subject: Re: date bug

"Assaf Feuerstein" <[EMAIL PROTECTED]> 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, [EMAIL PROTECTED] 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."



_______________________________________________
Bug-coreutils mailing list
Bug-coreutils@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to