Skip to content
Prev 164467 / 398503 Next

getting ISO week

Gabor Grothendieck <ggrothendieck <at> gmail.com> writes:
Gabor,

the results of format(aDate, "W") appear to be incorrect anyway, see:

    format(as.Date("2008-01-01"), "%W")     #-> "00"

There is never a week 0, this should be week 1.

    format(Sys.Date(), "%W")                #-> "49"

but my business calendar says today's (Dec. 11, 2008) week is week 50
which is what Brian Ripleys proposed 'strftime(x, "%V")' returns.

There could be a format "%E" (not used up to now) for returning a
correct week number according to the European standard.

Yours,  Hans Werner