Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 584
Alex Avatar asked Nov 12 '10 21:11

Alex


2 Answers

 SELECT GETDATE() - 1

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

like image 129
veljkoz Avatar answered Sep 29 '22 14:09

veljkoz


DECLARE @Now datetime, @Calc datetime

SET @Now = GetDate()
SET @Calc = DateAdd(hh, -24, @Now)
like image 20
Amy B Avatar answered Sep 29 '22 12:09

Amy B