复制代码 代码如下:
MidnightOf
ALTER FUNCTION [dbo].[MidnightOf] (
@Date DATETIME
) RETURNS DATETIME
AS
BEGIN
RETURN (dateadd(year,(datepart(year,@Date) - 2000),dateadd(month,(datepart(month,@Date) - 1),dateadd(day,(datepart(day,@Date) - 1),'2000'))))
END
复制代码 代码如下:
SELECT DATEADD(day,DATEDIFF(day,'20010101',CURRENT_TIMESTAMP),'20010101');
复制代码 代码如下:
SELECT CAST((CAST(CAST(CURRENT_TIMESTAMP AS DATE) AS CHAR(10)) + ' ' + '00:00:00.000') AS DATETIME)
复制代码 代码如下:
SELECT CAST(CAST(CURRENT_TIMESTAMP AS DATE) AS DATETIME)
新闻热点
疑难解答