Published: 25 Apr 2021 › Updated: 25 Apr 2021

DATEADD to change datetimes in SQL Server
Basic syntax
DATEADD(<Unit of time>, <Units>, <Date>)
-- Add 5 days to 04/23/2021
DATEADD(DAY, 5, '2021-04-23')
-- Substract 5 days to 04/23/2021
DATEADD(MONTH, -5, '2021-04-23')
Units of time
| Unit of time | Abbreviation |
|---|---|
| NANOSECOND | ns |
| MICROSECOND | mcs |
| MILLISECOND | ms |
| SECOND | ss, s |
| MINUTE | mi, n |
| HOUR | hh |
| WEEKDAY | dw, w |
| WEEK | wk, ww |
| DAY | dd, d |
| DAYOFYEAR | dy, d |
| MONTH | mm, m |
| QUARTER | qq, q |
| YEAR | yy, yyyy |
More information
To get more info on the Docs
Leave DATEADD to change datetimes in SQL Server to:
Read more #hive-169321 posts
Best Posts From Laura Durieux
We have not curated any of lauweded's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.