Formatting dates


show more Formatting dates provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training show less
please wait ...

Formatting dates

The date format function is used for formatting date and time values as strings for display. We're not going to select a database for this lesson. For example, if I say SELECT DATE FORMAT, and I'll use the NOW function for current time stamp. And I'll put a FORMAT string in single quotes. And when I press Go, we get a formatted date that says Thursday, 27th of March, 2014.

The date format function takes two arguments. The first argument is a date. In this case, we're passing it the current. Time stamp with the NOW function. And the second argument is a string with formatting instructions. It's called a format string. And each of these format specifiers has a percent sign and a letter indicating what format option it represents. Here's a list of the various format specifiers available.

I suggest you experiment a lot to become familiar with it. As another example, here's a format that would give us a standard SQL date. This is. Fairly common and useful. Percent capital Y, percent m...

Formatting dates
Video duration: 1m 51s 4h 24m Beginner

Viewers:

Formatting dates provides you with in-depth training on Developer. Taught by Bill Weinman as part of the MySQL Essential Training

Subject:
Developer
Software:
MySQL
Author:
please wait ...