Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1700

Advanced DateDiff Calculation In SQL (exclude weekend time)

Newsgroups comp.databases.ms-sqlserver
Date 2014-03-03 12:35 -0800
Message-ID <23b8614b-5839-47ec-a647-37183eb2643d@googlegroups.com> (permalink)
Subject Advanced DateDiff Calculation In SQL (exclude weekend time)
From andy.mcvicker@siemens.com

Show all headers | View raw


Hi Everyone

I have an odd question for SQL

I'm trying to do a calculation on 2 date fields.  I'd like to get the exact difference in time between 2 dates but I don't want to include any time if the duration falls over a weekend.  For example, find me the difference in time with the following but don't include any time after Friday at midnight to Sunday at midnight.

StartDate = 03/14/2014 12:09:00pm
EndDate = 03/17/2014 09:24:00am

Or even more seemingly complex...

StartDate = 03/14/2014 12:09:00pm
EndDate = 03/24/2014 09:24:00am

Best Regards,
Andy

Back to comp.databases.ms-sqlserver | Previous | NextNext in thread | Find similar


Thread

Advanced DateDiff Calculation In SQL (exclude weekend time) andy.mcvicker@siemens.com - 2014-03-03 12:35 -0800
  Re: Advanced DateDiff Calculation In SQL (exclude weekend time) Ross Presser <rpresser@gmail.com> - 2014-03-03 13:38 -0800
  Re: Advanced DateDiff Calculation In SQL (exclude weekend time) --CELKO-- <jcelko212@earthlink.net> - 2014-03-09 19:08 -0700
  Re: Advanced DateDiff Calculation In SQL (exclude weekend time) --CELKO-- <jcelko212@earthlink.net> - 2014-03-09 19:08 -0700
  Re: Advanced DateDiff Calculation In SQL (exclude weekend time) rja.carnegie@gmail.com - 2014-03-09 21:32 -0700

csiph-web