Skip to content

Instantly share code, notes, and snippets.

@stratigos
Created July 8, 2016 15:53
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 stratigos/6f1b86309f314830e5ca75ad168c5579 to your computer and use it in GitHub Desktop.
Save stratigos/6f1b86309f314830e5ca75ad168c5579 to your computer and use it in GitHub Desktop.
Ruby: get the number of weekdays in the last year up to today.
( (1.year.ago.to_date)..(Date.today) ).select{ |d| (1..5).include? d.wday }.size.to_f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment