Convert SQL Server DateTime to milliseconds Since 1970 (UNIX Epoch Time).
-- Validate at https://www.epochconverter.com
select cast(datediff(second, '1970-01-01', getutcdate()) as bigint) * 1000 as EpochTime; -- utc now
select cast(datediff(second, '1970-01-01', getdate() ) as bigint) * 1000 as EpochTime; -- local now