From the course: Practice It: Advanced SQL

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Introduction to datetime manipulation

Introduction to datetime manipulation - SQL Tutorial

From the course: Practice It: Advanced SQL

Introduction to datetime manipulation

- [Instructor] Date/time manipulation is a common task in any form of data analysis. Some common tasks include extracting today's current date, extracting date features such as the day, month, or year, and calculating the difference between two dates. A few common operators include CURDATE, which just provides the current date; DATEDIFF, which includes the difference between two dates; YEAR extracts the year from a date; MONTH extracts the month from a date; and DAY extracts the day. DATEFORMAT takes in a date column and allows you to format it as you like, such as converting a year, month, day format to only include the year and month. We will now take a look at a couple of examples to put your knowledge to the test.

Contents