Kolodvor

ruby, rails, javascript, jquery, …

Main menu

Skip to primary content
Skip to secondary content
  • Home
  • About me

Monthly Archives: August 2010

Number of workdays between two dates

Posted on August 1, 2010 by vlado
3

It is pretty simple to get number of work days between two dates. For example we can get the number of workdays in this month.

  start_date = Date.civil(2010, 8, 1)
  end_date = Date.civil(2010, 8, 31)
  workdays = (start_date..end_date).select { |day| ![0, 6].include?(day.wday) }.size

Continue reading →

Posted in Rails, Ruby | 3 Replies

Archives

  • March 2012
  • March 2011
  • August 2010
  • July 2010
  • June 2010
  • February 2010
  • January 2010
  • September 2009
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • August 2007
  • July 2007

Meta

  • Log in
Proudly powered by WordPress