Subtract 24hrs in T-SQL from Today's Date
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
精彩评论