bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date calculations bug


From: Stefan Alpers
Subject: Re: Date calculations bug
Date: Fri, 2 Dec 2005 20:07:46 +0100

Thank you guys for correcting my fault. Next time I will read the man page
properly before posting a bug report ;-)

stefan


2005/12/2, Bob Proulx <address@hidden>:
>
> 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.
>
> > address@hidden:>date +"%G-%m-%d"
> > 2005-12-02
> > address@hidden:>date  -d +30days +"%G-%m-%d"
> > 2005-01-01
> > address@hidden:>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
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]