From the course: Querying Microsoft SQL Server 2012

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Queries using date and time

Queries using date and time - SQL Server Tutorial

From the course: Querying Microsoft SQL Server 2012

Start my 1-month free trial

Queries using date and time

- SQL Server has support for storing date and time data in the database. Because date and time are not stored in the same format as a character or numeric-based data type, they can cause issues for queries when you aren't aware of the differences. Also, SQL has some special functions for working with these data types that allow you to customize the return results in your query. SQL Server includes many date and time functions, too many to be covered here, but we'll look at some of the most common functions that you can use in your SQL queries. Now remember that dates have the potential to cause issues with your queries due to the different formats in which they can be represented. As an example, in North America, there are two separate formats. The US represents the date as the month first, the day second and the year last; and Canada uses a format with the day first, the month second and the year last. So it is best to use a neutral language format when you are working with your data…

Contents