Waivio

Recommended Posts

DATEADD to change datetimes in SQL Server

0 comments

lauweded19.484 years ago

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

Comments

Sort byBest
AI
Waivio AI Assistant
How can I help you today?