SQLzoo.net

Subtract dates

SQL Server
SQL Standard allows dates to be subtracted. We specify the unit and the number of digits of the result answer: YEAR MONTH DAY HOUR MINUTE SECOND

We want to know how long has it been since Tom Jones featured on TOTP.



Specific to SQL Server
We can get the answer in days, or in years. MSDN documentation on DATEDIFF

Related links:

  • DATES