convert datetime to timestamp in ms sql server
在ms sql server中,把一个日期转换为时间戳:
源代码:
CREATE FUNCTION [dbo].[svf_UNIX_TIMESTAMP] ( @ctimestamp DATETIME ) RETURNS BIGINT AS BEGIN DECLARE @return BIGINT SELECT @return = DATEDIFF_BIG(millisecond,'1970-01-01 00:00:00.000', @ctimestamp) RETURN @return END
实例: