Blog Pages

How to get today's date

DECLARE @Today DATETIME, @Tomorrow DATETIME

SELECT -- @Today = today 00:00:00, @Tomorrow = tomorrow 00:00:00
   @Today = DATEADD(DAY, DATEDIFF(DAY, '19000101', GETDATE()), '19000101'), 
   @Tomorrow = DATEADD(DAY, 1, @Today) 
select @Tomorrow = DATEADD(mi, -1, @Tomorrow) -- @Tomorrow = today 23:59:59
SELECT @Today ,@Tomorrow

No comments:

Post a Comment