Introduction
Dealing with dates
Working with time data
Date and time date
Extracting dates and times
Doing arithmetic with dates
Converting date and time data
Current date and time data
Building date and time data from parts
Summary and review

Instruction

Good work! The GETDATE() and GETUTCDATE() functions return the old date and time data type: DATETIME.

SQL Server also offers functions that return the new more detailed DATETIME2 data type. They are:

  • SYSDATETIME()—returns the system's date and time.
  • SYSUTCDATETIME()—returns the system's date and time in UTC.
  • SYSDATETIMEOFFSET()—returns the current date, time, and time zone as a DATETIMEOFFSET() date type.

Exercise

Run the template query, and observe the difference between the results of different date and time functions. Then click I'm done. Next exercise.