Skip to content

Instantly share code, notes, and snippets.

@scan
Last active April 20, 2016 15:08
Show Gist options
  • Save scan/4d43db26af641fea7b235e5e6e4312c8 to your computer and use it in GitHub Desktop.
Save scan/4d43db26af641fea7b235e5e6e4312c8 to your computer and use it in GitHub Desktop.
Get the calendar week number from a date
module Weeks
def current_week
Date.today.strftime('%U').to_i
end
def weeks_this_year
Date.today_end_of_year.strftime('%U').to_i
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment