Prof Brian Ripley <[EMAIL PROTECTED]> writes:

> > %W seems to be what is known as "ISO dates" (week starts on Monday),
> > except that
> >
> >>  strftime(as.POSIXlt(as.Date("2005-01-01")), "%U")
> > [1] "00"
> >
> > should be week 53, 2004 according to my printed calendar, and emacs
> > calendar-mode too.
> 
> I _did_ say
> 
> >> That's nothing like as easy, as it is not well-defined.
> 
> The POSIX definition is
> 
> %U
>      Replaced by the week number of the year as a decimal number [00,53].
>      The first Sunday of January is the first day of week 1; days in the
>      new year before this are in week 0.
> 
> %W
>      Replaced by the week number of the year as a decimal number [00,53].
>      The first Monday of January is the first day of week 1; days in the
>      new year before this are in week 0.
> 
> so it is doing what it is documented to do.  I'd take POSIX as more
> definitive than Emacs ....

But not more definitive than the ISO standard, I hope. There are
probably more that 1e8 calendars printed each year according that one. 

The two routines are just not doing the same thing. Calendar-mode goes
by the ISO standard, strftime by POSIX definitions. Of course it all
depends on what the user actually wanted.

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])                  FAX: (+45) 35327907

______________________________________________
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to