From the course: MySQL Essential Training
Unlock this course with a free trial
Join today to access over 23,400 courses taught by industry experts.
Date and time types - MySQL Tutorial
From the course: MySQL Essential Training
Date and time types
- [Bill] Hi, I'm Bill Weinman. My SQL supports a complete set of date and time types. These include date, time, a standalone year type, and a combined date time type. This lesson, we'll use the scratch database. I'll go ahead and now execute that statement. And I've copied some SQL from the chapter two exercise file. I'll start with SELECT NOW. SELECT NOW simply returns the date and time for right now and in the time zone of the server. It's important to note that this is the time zone of the server and not the time zone of your workstation. In many cases, those will be the same, but not always. You can find out about your time zones by using this statement, SHOW VARIABLES LIKE '%time_zone%' and we have two system variables. One is system_time_zone, which in my case for my server is set to PST, which is Pacific Standard Time, the US Pacific time, and time_zone, which is set to the value of SYSTEM, which makes it the same as the system_time_zone variable. So when I SELECT NOW, I get it…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.