DATE_FORMAT() FUNCTION in MySQL

DATE_FORMAT() FUNCTION The MySQL DATE_FORMAT function is used to format a date. The various versions of MySQL support the DATE_FORMAT function, namely, MySQL 5.7, MySQL 5.6, MySQL 5.5, MySQL 5.1, MySQL 5.0, MySQL 4.1, MySQL 4.0 and MySQL 3.23.

Syntax:

DATE_FORMAT( date, format_mask )

Parameters:

date: It is used to specify the date to be formatted. format_mask: It is used to specify the format to be applied to the date.

Example 1:

mysql> SELECT DATE_FORMAT ('2019-07-05', 

Output:

'Friday'

Explanation:

The date value has been formatted as specified.

Example 2:

mysql> SELECT DATE_FORMAT ('2019-07-05', 

Output:

'July 05, 2019'

Explanation:

The date value has been formatted as specified.

Please follow and like us:
Content Protection by DMCA.com