From: Harald Hanche-Olsen <hanche@math.ntnu.no>
To: help-gnu-emacs@gnu.org
Subject: Re: Week number
Date: Wed, 15 Oct 2008 23:28:23 +0200 [thread overview]
Message-ID: <pco63ntr1jc.fsf@math.ntnu.no> (raw)
In-Reply-To: mailman.1043.1224016162.25473.help-gnu-emacs@gnu.org
+ Xavier Maillard <xma@gnu.org>:
> 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 ?
There are different ways to count week numbers. You can bet that any
function having -iso- in its name will use ISO week numbering, which
corresponds to %V, not to %W. Here are the relevant bits from the
strftime man page on freebsd.
%U is replaced by the week number of the year (Sunday as the first day
of the week) as a decimal number (00-53).
%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).
(Note also that the proper way to write the week the ISO way is %GW%V,
not %YW%V as you might think.)
--
* Harald Hanche-Olsen <URL:http://www.math.ntnu.no/~hanche/>
- It is undesirable to believe a proposition
when there is no ground whatsoever for supposing it is true.
-- Bertrand Russell
next prev parent reply other threads:[~2008-10-15 21:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.994.1223980354.25473.help-gnu-emacs@gnu.org>
2008-10-14 12:43 ` Week number Charles Sebold
2008-10-14 12:53 ` Charles Sebold
2008-10-14 20:25 ` Xavier Maillard
2008-10-14 21:13 ` Charles Sebold
2008-10-14 21:37 ` Peter Dyballa
2008-10-14 21:42 ` Charles Sebold
2008-10-15 8:25 ` Xavier Maillard
[not found] ` <mailman.1043.1224016162.25473.help-gnu-emacs@gnu.org>
2008-10-14 21:09 ` Charles Sebold
2008-10-14 21:56 ` Drew Adams
2008-10-15 8:25 ` Xavier Maillard
2008-10-15 21:28 ` Harald Hanche-Olsen [this message]
2008-10-14 6:25 Xavier Maillard
2008-10-14 13:08 ` Paul R
2008-10-14 20:25 ` Xavier Maillard
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pco63ntr1jc.fsf@math.ntnu.no \
--to=hanche@math.ntnu.no \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).