-3

I am using automation tool in that I am getting now time in epoch format. There is no time. I am getting one is start of process time and other end process time

Process start time : 1505815205159
Process end time   : 1505816321742

I need the difference of these two epoch times in minutes in SQL Server - is there a way to do this?

TylerH
  • 20,799
  • 66
  • 75
  • 101
deepti
  • 729
  • 4
  • 17
  • 38
  • may be this will help https://stackoverflow.com/questions/4787827/converting-epoch-timestamp-to-sql-serverhuman-readable-format – Imran Ali Khan Sep 21 '17 at 06:55
  • just subtract one from another and divide by 60 to gives you minutes ! Why need `SQL Server` to do it ? – Squirrel Sep 21 '17 at 06:56
  • one from another you mean normal subtraction and then divide by 60 giving me 18000 minutes – deepti Sep 21 '17 at 07:56

1 Answers1

0

UPDATE :

DECLARE @duration decimal (18,2)
SET @duration = 1505816321742 - 1505815205159
SELECT CONVERT(varchar, DATEADD(s, @duration * 1000, 0), 114)

Result : 09:56:40:000

DateAdd Intervals :

year, yyyy, yy = Year
quarter, qq, q = Quarter
month, mm, m = month
dayofyear = Day of the year
day, dy, y = Day
week, ww, wk = Week
weekday, dw, w = Weekday
hour, hh = hour
minute, mi, n = Minute
second, ss, s = Second
millisecond, ms = Millisecond
Imran Ali Khan
  • 8,469
  • 16
  • 52
  • 77
  • SELECT DATEADD(ss, 1291388960, '19700101') iam usinbg this its giving me arthematic overflow error – deepti Sep 21 '17 at 07:29