Exercise

Modifying the value of a date

Adding different date parts to a date expression proves to be useful in many scenarios. You can calculate, for example:

  • The delivery date of an order, by adding 3 days to the order date
  • The dates when a bonus is received, knowing that they are received every 3 months, starting with a certain date.

In SQL Server, you can use DATEADD() for adding date parts to a date. In this exercise, you will get familiar with this function.

Instructions 1/3

undefined XP
  • 1

    Retrieve the date when each voter had their 18th birthday.

  • 2

    Add five days to the first_vote_date, to calculate the date when the vote was processed.

  • 3

    Calculate what day it was 476 days ago.