date subtract sql code example Example 1: 3 days back in sql server DATEADD(DAY, -3, GETDATE()) Example 2: sql server today minus n SELECT GETDATE() - 1