Laura Durieux avatar

DATEADD to change datetimes in SQL Server

lauweded

Published: 25 Apr 2021 › Updated: 25 Apr 2021DATEADD to change datetimes in SQL Server

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 timeAbbreviation
NANOSECONDns
MICROSECONDmcs
MILLISECONDms
SECONDss, s
MINUTEmi, n
HOURhh
WEEKDAYdw, w
WEEKwk, ww
DAYdd, d
DAYOFYEARdy, d
MONTHmm, m
QUARTERqq, q
YEARyy, yyyy

More information

To get more info on the Docs

Leave DATEADD to change datetimes in SQL Server to:

Written by

Young Dev Girl

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.

More Posts From Laura Durieux