bug-coreutils
[Top][All Lists]
Advanced

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

bug#8466: 2012 week number bug


From: Bob Proulx
Subject: bug#8466: 2012 week number bug
Date: Sun, 10 Apr 2011 14:11:11 -0600
User-agent: Mutt/1.5.21 (2010-09-15)

tags 8466 + moreinfo notabug
thanks

Chichasov, Nikolay wrote:
> Also 2017 and presumably every year when Jan 01 falls on Sunday.
> Checked for kernel 2.6.16 and 2.6.32, same sht.
> This is CRUEL one, man.

For future reference the kernel doesn't have anything do do with date
calculations.

> ===  man for 'date'
> %U     week number of year with Sunday as first day of week (00..53)
> ===

And the info documentation (where the full manual exists) says:

  info coreutils "date invocation"

  `%U'
     week number of year, with Sunday as the first day of the week
     (`00'...`53').  Days in a new year preceding the first Sunday are
     in week zero.

> sh-3.1$ date -d "01/01/2011" +%U
> 00

      January 2011
  Su Mo Tu We Th Fr Sa
                     1
   2  3  4  5  6  7  8
   9 10 11 12 13 14 15
  16 17 18 19 20 21 22
  23 24 25 26 27 28 29
  30 31

Correct.

> sh-3.1$ date -d "01/01/2012" +%U
> 01

      January 2012
  Su Mo Tu We Th Fr Sa
   1  2  3  4  5  6  7
   8  9 10 11 12 13 14
  15 16 17 18 19 20 21
  22 23 24 25 26 27 28
  29 30 31

Correct.

What did you expect to see there?

You might also want to read the FAQ where it talks about week numbers
and has additional references.

  
http://www.gnu.org/software/coreutils/faq/#The-date-command-is-not-working-right_002e

Bob





reply via email to

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