I am trying to convert my bigint into a date and time. I have used the following link as a guidedance but it is not working as it is suppose to because from my understanding in this solution it is based on a millesecond.
I have the following coding and have tried the following:
declare @starttime as bigint;
set @starttime = '2021021209295600000';
Select dateadd(HOUR, (@starttime / 100000) % (24 * 60 * 60),
dateadd(day, (@starttime / 100000) / (24 * 60 * 60), '1970-01-01'))
The following error is being prompted:
The data types time and datetime are incompatible in the add operator.
Also as mentioned earlier I have tried the above mentioned solution however the following output is given which is incorrect select dateadd(s, convert(bigint, @starttime) / 1000, convert(datetime, '1-1-1970 00:00:00'))
Can someone help me please? The expected value is 2021-02-12 09:29:56