Stefan Alpers wrote:
> I probably found a bug in the core utils date package.

Thanks for reporting the problem.  However you are using the %G
format.  Could you say why?  There are so many misconceptions about
week numbers.

> Today (2005-12-02) I used date to calculate the date for 30 days in
> advance which returned 2005-01-01. this result is obviously wrong as
> it lies in the past. This was run on a Suse Linux 9.1 fully
> patched. I could reproduce these results on a Debian 3.1 fully
> patched.  Attached you find a screenshot.

> [EMAIL PROTECTED]:>date +"%G-%m-%d"
> 2005-12-02
> [EMAIL PROTECTED]:>date  -d +30days +"%G-%m-%d"
> 2005-01-01
> [EMAIL PROTECTED]:>date --version
> date (coreutils) 5.2.1

The %G format is "the 4-digit year corresponding to the %V week
number".  That is not the same as the year at that time.

Please use the %Y format instead.  And in fact for the format string
you are using the %F is simplest.

  date -d +30days +%F
  2006-01-01

Bob


_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils

Reply via email to