Convert specific BigInt to DateTime in T-SQL
Convert specific BigInt to DateTime in T-SQL I have bigInt: 635307578922100000 which I need to convert to DateTime . 635307578922100000 DateTime I've tried few ways to do this: SELECT DATEADD(S, CONVERT(bigint,635307578922100000) / 1000, CONVERT(DATETIME, '1-1-1970 00:00:00')) and: SELECT DATEADD(ms, 635307578922100000 / 86400000, (635307578922100000 / 86400000) +25567) While I found the codes above work with bigInts like: 1283174502729 , with my bigInt I get the following error: bigInts 1283174502729 Msg 8115 ... Arithmetic overflow error converting expression to data type datetime. Does anyone have any idea how to solve it? What would be your expected result for the given input '635307578922100000' – StackUser Jul 26 '16 at 8:12 It looks like these are ticks. Possible dupli...
