Re: Bugs in 'date' coreutils v 5.0
Andreas Schwab <[email protected]> Thu, 08 Jan 2004 11:44:54 +0100
| Newsgroups | gmane.comp.gnu.core-utils.bugs,gmane.comp.gnu.sh-utils.bugs |
|---|---|
| Message-ID | <[email protected]> |
"Sebastien ESTIENNE" <[email protected]> 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: > sebest@carbon sebest $ date > Wed Jan 7 17:04:02 CET 2004 > sebest@carbon sebest $ date -d "7 days ago" '+%Y-%V' > 2003-01 > sebest@carbon sebest $ date -d "7 days ago" '+%Y-%U' > 2003-52 > sebest@carbon sebest $ date -d "6 days ago" '+%Y-%V' > 2004-01 > sebest@carbon 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, [email protected] 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."