help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: Week number


From: Peter Dyballa
Subject: Re: Week number
Date: Tue, 14 Oct 2008 23:37:45 +0200


Am 14.10.2008 um 22:25 schrieb Xavier Maillard:

I compared the results of your function and the result from a
simple (format-time-string "%W") for the current date and I got
week 42 for the former and week 41 for the latter. Can you
explain this ?

On the command line 'date +%W' returns 41 – although here in Germany it's already 42nd week ... This number is displayed by 'date +%V'. My documentation says:

%V is replaced by the week number of the year (Monday as the first day of the week) as a decimal number (01-53). If the week containing January 1 has four or more days in the new year, then it is week 1; otherwise it is the last week of the previous year, and the next
           week is week 1.

%W is replaced by the week number of the year (Monday as the first day
           of the week) as a decimal number (00-53).

So %W counts the complete weeks and %V counts the legal weeks. And (format-time-string "%V") returns 42 for me. See also 'man strftime'.

--
Greetings

  Pete

The world would be a better place if Larry Wall had been born in Iceland, or any other country where the native language actually has syntax.
                                – Peter da Silva







reply via email to

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