Posted By

stancox on 06/21/11


Tagged

count days working


Versions (?)

count working days in month


 / Published in: Ruby
 

  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  

You need to login to post a comment.