From the course: MySQL Essential Training (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Date and time types

Date and time types

- [Instructor] MySQL supports a complete set of date and time types. These include date, time, a standalone year type, and a combined date-time type, and a timestamp that's automatically updated when a row is created or updated. For this lesson, we'll use the scratch database. So I'll type use scratch. And I'll execute that. MySQL stores dates and times in a standard SQL format. If I select the now function, I get a result that shows this date and time in SQL format. The SQL format has the year first, then month, then day, then hour, then minute, then seconds. This means that all the more significant values are to the left and the less significant values are to the right. And this makes it very convenient for sorting and searching. Different countries and different locales have different localized formats for dates and times, some with the year to the left, some with the year to the right, some in odd, mixed up orders like the month-day-year format common in the US. Standard SQL…

Contents