I have an Excel sheet and have this formula below. I would like to calculate the same formula with sql. The result will be in second.
Thank you,
declare @t1 AS datetime
declare @t2 AS datetime
declare @t3 AS datetime
declare @t4 AS datetime
set @t1 = '2011-11-04 00:00:00.000' --start date
set @t2 = '2012-01-16 18:21:55.000' --start time
set @t3 = '2011-11-10 00:00:00.000' --end date
set @t4 = '2012-01-16 12:10:00.000' --end time
Excel formula
((end date-start date-1)+(end time-(0,375)))*24*60*60
0,375 value means 9 hour
formula result will be = 443400 second
You mention that you not using Start Time in your formula?
Here it comes: