I'm facing a problem with an epoch timestamp with miliseconds attached.
The format of my epoch timestamp is:
1439263190,2609999
The build in dateadd function can only handle int
values.
Are there any workarounds?
KR Johann
I'm facing a problem with an epoch timestamp with miliseconds attached.
The format of my epoch timestamp is:
1439263190,2609999
The build in dateadd function can only handle int
values.
Are there any workarounds?
KR Johann
Epoch Time (aka Unix Time) is the number of seconds since midnight on 1/1/1970.
To work around a DateAdd function that will only handle integer values, simply assign the value to an integer variable and use that in the call to DateAdd.
For example, this code:
declare @epoch decimal(20,7) = 1439263190.2609999
declare @epoch2 int = @epoch
select @epoch, @epoch2, DATEADD(s, @epoch2, '1970-01-01 00:00:00')
gives this result:
1439263190.2609999 1439263190 2015-08-11 03:19:50.000