tag:blogger.com,1999:blog-7998687752365941655.post1330510950522629604..comments2022-03-25T16:46:26.176+05:30Comments on VM Blogs: Calculating business hoursVisakh Murukesanhttp://www.blogger.com/profile/02874515877085669105noreply@blogger.comBlogger7125tag:blogger.com,1999:blog-7998687752365941655.post-56278603494016803682012-03-21T22:29:37.754+05:302012-03-21T22:29:37.754+05:30Can you show how you're passing the dates?Can you show how you're passing the dates?Visakh Murukesanhttps://www.blogger.com/profile/02874515877085669105noreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-9064005041513141492012-03-21T22:25:33.683+05:302012-03-21T22:25:33.683+05:30Thanks for this useful code! This has saved us a f...Thanks for this useful code! This has saved us a few hours of head scratching! I'm using this to calculate minutes, however, if the dates are the same, this returns 0 minutes. Thanks for your helpAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-13516861705451637222012-03-01T23:53:21.210+05:302012-03-01T23:53:21.210+05:30Drop the /60 part in last select which retrieves v...Drop the /60 part in last select which retrieves value for @TotalHours and it will give total in minutesVisakh Murukesanhttps://www.blogger.com/profile/02874515877085669105noreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-70344456940335982082012-03-01T19:27:24.039+05:302012-03-01T19:27:24.039+05:30How can this be edit to diplay minutes rather than...How can this be edit to diplay minutes rather than just the hours betweenmjs21https://www.blogger.com/profile/13952758934091411149noreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-5647849137030872102011-07-15T19:43:41.515+05:302011-07-15T19:43:41.515+05:30I've added that check also now. Thanks for the...I've added that check also now. Thanks for the feedback :)Visakh Murukesanhttps://www.blogger.com/profile/02874515877085669105noreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-53452965766963988902011-07-15T07:25:30.956+05:302011-07-15T07:25:30.956+05:30This is a very useful function however if the Star...This is a very useful function however if the Startdate and Enddate are the same day it returns an incorrect value.schuhtlhttps://www.blogger.com/profile/05908157027586617321noreply@blogger.comtag:blogger.com,1999:blog-7998687752365941655.post-68792796544861618242010-05-25T18:48:30.288+05:302010-05-25T18:48:30.288+05:30Thank you for sharing this function! I have found...Thank you for sharing this function! I have found a small issue...when you run the following (same start and end date that have times outside of the business hours) it will return 9 instead of 0.<br /><br />SELECT dbo.GetBusinessHours('05/03/2010 18:00', '05/03/2010 20:00', '08:00', '17:00'))schuhtlhttps://www.blogger.com/profile/05908157027586617321noreply@blogger.com