Skip to content

Instantly share code, notes, and snippets.

@caingougou
Last active December 13, 2015 22:19
Show Gist options
  • Save caingougou/4983966 to your computer and use it in GitHub Desktop.
Save caingougou/4983966 to your computer and use it in GitHub Desktop.
Get current weekdays
#!/usr/bin/env ruby
require 'active_support/all'
Time::DATE_FORMATS[:year_month_day] = "%Y/%m/%d"
beginning_of_week = DateTime.now.beginning_of_week
end_of_week = beginning_of_week + 4.days
puts beginning_of_week.to_s(:year_month_day) + '-' + end_of_week.to_s(:year_month_day)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment