datediff

DATEDIFF in Business Working Hours & Days Only

别等时光非礼了梦想. 提交于 2021-02-20 04:55:27
问题 I am trying to write a report and am a little stuck :/ I am trying to show the hours and minutes between two dates however minus the non business working hours. Example a business works weekdays between 08:00 until 17:00 and a call was logged at 16:00 today and closed tomorrow at 16:00 so that would be 24 hours minus the business hours so would work out at 9 hours. I have also created a seperate table which holds all the days of the years except weekends and the start of the business working

SQL Server Calculate during 07H00 and 23H00 during weekdays

淺唱寂寞╮ 提交于 2021-01-29 11:48:23
问题 I have a dataset I am retrieving from DevOps Warehouse but the report readers want to only report on the following: Time calculated should only be between 07:00 & 23:00 and Monday to Friday. I have tried a few blogs but all of it calculated a ridiculous amount of minutes Start Date: 2019-08-19 06:05:30.483 End Date : 2019-08-19 08:13:59.357 Total Minute : 20177 Simple DateDiff : 128 My Current T-SQL query looks like: ;WITH cte AS ( SELECT System_Id, StartDate, EndDate, DATEADD(d, Number,

Working days between two dates in Snowflake

无人久伴 提交于 2021-01-28 06:10:23
问题 Is there any ways to calculate working days between two dates in snowflake without creating calendar table, only using "datediff" function 回答1: After doing research work on snowflake datediff function, I have found the following conclusions. DATEDIFF(DAY/WEEK, START_DATE, END_DATE) will calculate difference, but the last date will be considered as END_DATE -1. DATEDIFF(WEEK, START_DATE, END_DATE) will count number of Sundays between two dates. By summarizing these two points, I have

Oracle sql: filtering repeated rows that only differ by a tiny amount of time

做~自己de王妃 提交于 2021-01-28 02:41:34
问题 I have an Oracle table with event alarms, and due to a weird and unknown -to me- condition alarms get repeated sometimes so I was asked to create a service that will remove repeated alarms from that Oracle table. The condition to consider an alarm (a row in the table) as repeated is that there is another one with the same exact PKN_EVENTNAME and RECEIVEDDATE only differs from the previous one by a tiny amount of time (let's say 10 seconds for example -up or down-). What I'm trying to do first