Hi there, Happy New Year to all. So I am trying to work out the difference between today's date (GETDATE()) and a Target Date in a specific table (targetdate) When I use the DATEDIFF function it is including non working days in the calculation (weekends and bank holidays). Although our date calandar table provided to us from a third party supplier will tell you the weekends, it does not tell you the bank holidays. Luckily there is another table in the database called - ih_non_work_days. The format of the date is "2014-12-25 00:00:00.000" for example in that table. How do I using my "targetdate" and today's date calculate in days the differance - excluding the dates that exist in the ih_non_work_days database? So for now my basic script looks like - SELECT com.comm_reference AS'Referance',com.current_task_target_date AS'TargetDate',DATEDIFF(D,com.current_task_target_date,GETDATE())AS'Incorrect Date Calculation'FROM[dbo].[em_communication]as com |
↧
Using DateDiff to work as Excel Networkdays
↧