Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
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, and percent d, with dashes in between them for the year, month and day. And a space and percent capital T for the time and when I press Go that's a standard SQL. FORMAT DATE.
The date format function is used for formatting date and time values for display. I suggest you experiment a lot with the various format specifiers to familiarize yourself with them.
Get unlimited access to all courses for just $25/month.Become a member