From: pjb@... (Pascal J. Bourguignon) Date: 2008-12-10T22:33:19+09:00 Subject: Re: want only the working hours(9am-5pm) between two dates Srikanth Jeeva writes: > want only the working hours(9am-5pm) between two dates, weekends should > be omitted.. > > i did this code.. > but i need the total hours between 9am-5pm, between the given dates.. > can any one plz help?? There's 8 hours between 9am-5pm, so 8 hour/working day. There's 5 working day/week. So if you can compute the number of weeks between the Monday following the first date, and the Monday preceding the last date, you can easily compute the number of working hours. if week-of(start) = week-of(end) then working-hours = working-hours/working-day * working-days(from start to end) else working-hours = working-hours/working-day * ( working-days(from start to end-of-week-after(start)) + working-days(from beginning-of-week-before(end) to end) + working-days/working-weeks * working-weeks(from end-of-week-after(start) to beginning-of-week-before(end))) end -- __Pascal Bourguignon__