From: dusty Date: 2008-12-11T01:03:27+09:00 Subject: Re: want only the working hours(9am-5pm) between two dates On Dec 10, 8:32 am, Srikanth Jeeva wrote: > Brian Candler wrote: > > Srikanth Jeeva wrote: > >> but i need the total hours between 9am-5pm, between the given dates.. > >> can any one plz help?? > > > Not sure what you mean. Do you mean (date2 - date1 + 1) * 8 ? > > > Use to_i on the answer if you don't want Rational arithmetic. > > hi brain, > > i mean.. > > date1="November 5th, 2008, 10:30 am" > date2="November 7th, 2008, 6:00 pm" > > i want only the working hours between 10:30 am to 6.00 pm,in these > dates... > > date can also be, > > date1="March 5th, 2005, 5:30 am" > date2="November 7th, 2006, 9:00 pm" > > all i need is working hours between these dates... > > first day & last days time makes complications here. > -- > Posted viahttp://www.ruby-forum.com/. You could try this beauty of a gem. http://runt.rubyforge.org/ http://runt.rubyforge.org/doc/files/doc/tutorial_te_rdoc.html