bug-sh-utils
[Top][All Lists]
Advanced

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

Re: Bugs in 'date' coreutils v 5.0


From: Andreas Schwab
Subject: Re: Bugs in 'date' coreutils v 5.0
Date: Thu, 08 Jan 2004 11:44:54 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3.50 (gnu/linux)

"Sebastien ESTIENNE" <address@hidden> writes:

> on 7 juanary 2004 when i ask date to print the week number of the year 7
> days ago, normaly the last day of the previous year, 'date' answers 01 so
> date -d "7 days ago" '+%V'
> and
> date -d "7 days ago" '+%V'
> give the same answer!!!

Of course they do, the commands are identical.  Did you mean "6 days ago"
in the second case?

> example:
> address@hidden sebest $ date
> Wed Jan  7 17:04:02 CET 2004
> address@hidden sebest $ date -d "7 days ago" '+%Y-%V'
> 2003-01
> address@hidden sebest $ date -d "7 days ago" '+%Y-%U'
> 2003-52
> address@hidden sebest $ date -d "6 days ago" '+%Y-%V'
> 2004-01
> address@hidden sebest $

Perfectly correct.

`%V'
     week number of year with Monday as first day of the week as a
     decimal (01...53). If the week containing January 1 has four or
     more days in the new year, then it is considered week 1;
     otherwise, it is week 53 of the previous year, and the next week
     is week 1. (See the ISO 8601 standard.)

$ date -d "8 days ago" '+%G-%V'
2004-01

`%G'
     The year corresponding to the ISO week number.  This has the same
     format and value as `%Y', except that if the ISO week number (see
     `%V') belongs to the previous or next year, that year is used
     instead.

Andreas.

-- 
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

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