Hi Logic24,
Please refer below sample for calculating the time differnce between two Dates.
SQL
DECLARE @Inserted_Time DATETIME, @Time_Difference VARCHAR(500)
SET @Inserted_Time = '01/02/2017'
SET @Time_Difference = convert(varchar(50),DateDiff(s, @Inserted_Time, GETDATE())/3600)+':'+
convert(varchar(50),DateDiff(s, @Inserted_Time, GETDATE())%3600/60)+':'+
convert(varchar(50),(DateDiff(s, @Inserted_Time, GETDATE())%60))
SELECT @Time_Difference 'TimeDifference'
Refer below article for executing the query at specific interval.
Simple Windows Service that runs periodically and once a day at specific time using C# and VB.Net