Skip to content

Instantly share code, notes, and snippets.

@andreyvit
Created January 6, 2009 10:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreyvit/43766 to your computer and use it in GitHub Desktop.
Save andreyvit/43766 to your computer and use it in GitHub Desktop.
require 'date'
def print_timesheet(first, last)
last_month = nil
first.upto(last) do |cur|
if last_month != cur.mon
puts
puts Date::MONTHNAMES[cur.mon]
puts
last_month = cur.mon
end
puts sprintf("%02d.%02d %03s\t 0\t-", cur.day, cur.mon, Date::ABBR_DAYNAMES[cur.wday])
puts if cur.wday == 0
end
end
print_timesheet Date.civil(2008, 05, 01), Date.civil(2009, 01, 01)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment