count working days in month


/ Published in: Ruby
Save to your folder(s)



Copy this code and paste it in your HTML
  1. d1 = Date.new( Time.now.year, Time.now.month, 1) #first day of month\period
  2. d2 = Date.new( Time.now.year, Time.now.month, -1) #end day of month\period
  3. wdays = [0,6] #weekend days by numbers on week
  4. weekdays = (d1..d2).reject { |d| wdays.include? d.wday} #Day.wday number day in week

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.