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

Before we move on to the next section, let's take a moment to summarize what we've already learned. SQL Server provides two kinds of current date and time functions:

  • Lower-precision system date and time functions return a DATETIME data type. These include GETDATE(), CURRENT_TIMESTAMP, and GETUTCDATE().
  • Higher-precision system date and time functions return a DATETIME2 or DATETIMEOFFSET data type. These include SYSDATETIME(), SYSUTCDATETIME(), and SYSDATETIMEOFFSET(). This group returns more precise time information (i.e., data with more fractional seconds). Usually, the default precision is seven.

Exercise

Click Next exercise to continue.