I need to convert a DateTime type value to BIGINT type in .Net ticks format (number of 100-nanosecond intervals that have elapsed since 12:00:00 midnight, January 1, 0001).<
you can use below sql to convert a date or utcdate to ticks
declare @date datetime2 = GETUTCDATE() or getdate()
declare @dateBinary binary(9) = cast(reverse(cast(@date as binary(9))) as binary(9))
declare @days bigint = cast(substring(@dateBinary, 1, 3) as bigint)
declare @time bigint = cast(substring(@dateBinary, 4, 5) as bigint)
select @date as [DateTime], @days * 864000000000 + @time as [Ticks]
and use below sql to convert the tick to a date
SELECT Converted = CAST(635324318540000000/864000000000.0 - 693595.0 AS DATETIME)