Introduction
Dealing with dates
Working with time data
Date and time date
Extracting dates and times
Doing arithmetic with dates
29. The DATEADD() to subtract dates
Converting date and time data
Current date and time data
Building date and time data from parts
Summary and review

Instruction

Using DATEADD() function can be used to subtract dates. Just enter the negative number to be added to your date.

It takes about 60 days to build a Boeing 777-800. To display the date when production of PerfectAir's Boeings started, you can use this query:

SELECT
  DATEADD(day, -60, ProducedDate) AS ProductionStarted
FROM Aircraft
WHERE Model = N'Boeing 777-800'

Exercise

Before the official launch, every plane has a 14-day test period. For the plane with ID of 4, show the Id, the original launch date, and the timestamp of when its test period began (name the column Tested).