Skip to content
Prev 167161 / 398502 Next

number of Mondays

Carlos Hernandez wrote:
This is where POSIXlt objects are useful:
sec   min  hour  mday   mon  year  wday  yday isdst
    0     0    12    11     2    59     3    69     0

Which means that I was born on a Wednesday (wday==3) in March (mon==2)
(some of the fields count from 0 and others, like mday, from 1;
presumably some UNIX vendor back in the Stone Age got their
implementation turned into a standard...).

This allows you to do stuff like:
wday
mon 0 1 2 3 4 5 6
  0 2 2 2 2 3 3 3
  1 4 4 4 4 4 4 4
  2 2 2 2 2 1 1 1

which I think is pretty much what you were looking for.