开发者

Subtract 24hrs in T-SQL from Today's Date

开发者 https://www.devze.com 2023-01-25 09:04 出处:网络
I\'m looking for a way to Subtract 24hrs in T-SQL 开发者_开发知识库from Today\'s Date Thanks! SELECT GETDATE() - 1

I'm looking for a way to Subtract 24hrs in T-SQL 开发者_开发知识库from Today's Date

Thanks!


 SELECT GETDATE() - 1

The -1 substracts one day from current date (GETDATE())


DECLARE @Now datetime, @Calc datetime

SET @Now = GetDate()
SET @Calc = DateAdd(hh, -24, @Now)


select dateadd(d,-1,GETDATE())


SELECT DATEADD(dd, -1, GETDATE()) AS yesterday
0

精彩评论

暂无评论...
验证码 换一张
取 消