We use a table of holidays here... So take your two dates..
Decide how many days are between them (You can just subtract the two date objects) Subtract how many weekend days are present between the two dates.. Subtract select count(*) from holidays where date <= begin and date => end Theres not much else out there thats pre-built.. On Mon, Sep 28, 2009 at 5:35 PM, Ludmila Moraes <[email protected]> wrote: > Thanks for all help. > > Finally, I could take out all the holidays. It is hard for holidays that > change every year. > > 2009/9/20 pepe <[email protected]> > > >> Sorry, I should also have added to take a look at >> ActiveSupport::CoreExtensions::Numeric::Time, which allows something >> like 1.week.from_now, 1.week.ago, etc. >> >> On Sep 19, 6:32 pm, pepe <[email protected]> wrote: >> > For the holidays you are going to need to store them somewhere as was >> > already pointed out in another post since they might even vary by >> > company. Calculating the weekend days should be easy using the >> > extended functionality for dates that Rails offers. You can check the >> > ActiveSupport::CoreExtensions::DateTime::* and >> > ActiveSupport::CoreExtensions::Date* modules for that. >> > >> > Good luck. >> > >> > On Sep 18, 2:17 pm, Penelope West <[email protected]> >> > wrote: >> > >> > > I want calculate the number of business day for the current month, but >> I >> > > don't know how I skip the holidays and weekends. >> > >> > > Could anyone help me with this? >> > >> > > Thanks >> > > -- >> > > Posted viahttp://www.ruby-forum.com/. >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---

