Tuesday, May 28, 2013

Add days, months, or years to a date in SQL

Use the following:
DATEADD(month, -3, GETDATE())
This example gets a date 3 months prior to the current date.  Use "day", or "year" in place of "month" to do similar calculations with those units.

No comments:

Post a Comment