In SQL Server, you can use the DATEADD()
function to add a specified time period to a given date. You can also use it to subtract a specified time period.
You can also combine DATEADD()
with other functions to format the date as required. For example, you could take ‘2020-10-03’, add 10 years, then return the (increased) year component.
This article contains examples to demonstrate.
Continue reading