Skip to content

Instantly share code, notes, and snippets.

@herrkris
Created January 11, 2011 23:02
Show Gist options
  • Save herrkris/775344 to your computer and use it in GitHub Desktop.
Save herrkris/775344 to your computer and use it in GitHub Desktop.
require 'date'
year = 2011
cw = 1
date = DateTime.new(year, 1, 1)
weekday = (date.wday == 0) ? 6 : date.wday - 1
date = date + (cw * 7) - weekday
puts date
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment