Reputation: 211
how do i compare the difference of 2 different Epoch Timestamp times, and then compare them both to differences in hours? while also returning the result of the differences between the two times?
for example we have these 2 different timestamps-
Epoch timestamp1: 1332516308 --being currenttime
Epoch timestamp2: 1335192846 --being currentime + a month
Upvotes: 0
Views: 86
Reputation: 3415
select datediff(hh, dateadd(ss, 1332516308, '19700101'),dateadd(ss, 1335192846, '19700101'))
That should give you the difference between the time.
Upvotes: 1
Reputation: 26717
you can use DateDiff
SELECT DateDiff(hh, '2012-03-22', GETDATE()) //difference in hours
more info at :
http://msdn.microsoft.com/en-us/library/ms189794.aspx
Upvotes: 2