Given two numbers, month and year, how can I compute the first and the last day of that month ? My goal is to output these three lines:
-
month / year (month in textual form but that is trivial)
-
for each day of the month: name of the day of the week for the current day: Fri. & Sat. & Sun. […]
-
day number within the month: 1 & 2 & 3 […] & 28 & .. ?
I'm looking for a solution using GNU date
or BSD date
(on OS X).
Best Answer
Some time ago I had similar issue. There is my solution:
Script itself:
I didn't have GNU
date
on machines I need it, therefore I didn't solve it with date. May be there is more beautiful solution.