DateDiff Example

0

Please login or register to vote for this query.

(click on this box to dismiss)

Drones and Model Aircraft Meta

Q&A for experienced flyers, pilots, and builders of drones and model aircraft

DECLARE @TransportTime DATETIME, @Bkg_TimeStamp DATETIME;
SET @Bkg_TimeStamp = '2020-12-01 07:08:01.000'
SET @TransportTime = '2020-12-01 07:03:02.000'

select (case when @TransportTime > @Bkg_TimeStamp then '-' else '' end +
(format(abs(datediff(S, @TransportTime, @Bkg_TimeStamp)) / 3600, '00') + ':' +
right('0' + cast(abs(datediff(S, @TransportTime, @Bkg_TimeStamp)) % 3600/60 as varchar(2)), 2) + ':' +
right('0' + cast(abs(datediff(S, @TransportTime, @Bkg_TimeStamp)) % 60 as varchar(2)), 2))) as WaitTimes;

Enter Parameters

Options:
Switch to main site
loading Hold tight while we fetch your results