Search results
Results From The WOW.Com Content Network
Definition and Usage. The DATE_FORMAT () function formats a date as specified. Syntax. DATE_FORMAT (date, format) Parameter Values. Technical Details. More Examples. Example. Format a date: SELECT DATE_FORMAT ("2017-06-15", "%M %d %Y"); Try it Yourself » Example. Format a date: SELECT DATE_FORMAT ("2017-06-15", "%W %M %e %Y"); Try it Yourself »
DATE_FORMAT() returns a string with a character set and collation given by character_set_connection and collation_connection so that it can return month and weekday names containing non-ASCII characters.
This tutorial shows you how to use the MySQL DATE_FORMAT function to format a date value based on a specific format.
MySQL retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range is '1000-01-01' to '9999-12-31' . The DATETIME type is used for values that contain both date and time parts.
Date and time values can be represented in several formats, such as quoted strings or as numbers, depending on the exact type of the value and other factors. For example, in contexts where MySQL expects a date, it interprets any of '2015-07-21', '20150721', and 20150721 as a date.
DATE_FORMAT () is essential for customizing the display of dates in applications, ensuring compatibility with graphical user interfaces (GUIs), facilitating data sorting and filtering based on date formats, and adapting date representations to different locale conventions.
The DATE_FORMAT function in MySQL is a powerful tool for formatting date and time values according to a specified format. This function is particularly useful when you need to present date and time information in a customized way, such as changing the order of elements or including additional text.
Since MySQL 4.0, you can format dates in many different ways using the DATE_FORMAT() method. This method accepts two required parameters with the following syntax: DATE_FORMAT(date, format) date: Required. The date to be formatted. format: Required. The format to use for the specified date. Examples.
The MySQL DATE_FORMAT() function formats a date value with a given specified format. You may also use MySQL DATE_FORMAT() on datetime values and use some of the formats specified for the TIME_FORMAT() function to format the time value as well.
9 Answers. Sorted by: 97. "MySQL retrieves and displays DATETIME values in 'YYYY-MM-DD HH:MM:SS' format." This is from mysql site. You can store only this type, but you can use one of the many time format functions to change it, when you need to display it. Mysql Time and Date functions.