MySQL DATE_FORMAT Function Guide & Examples

The DATE_FORMAT function in MySQL is used to convert dates into different string formats.

The basic syntax is as follows:

DATE_FORMAT(date, format)

For date, it refers to the date that needs to be formatted, which can be a date field or a date value, and format refers to the desired date format to convert to.

For example, to format the date field ‘2022-10-15′ as ’15-10-2022’, you can use the following statement:

SELECT DATE_FORMAT('2022-10-15', '%d-%m-%Y');

This will return ’15-10-2022′.

bannerAds