Mysql query for date format

if you wanted to change the format of a MySQL date from YYYY-MM-DD to MM/DD/YYYY or DD/MM/YYYY format you can use the DATE_FORMAT() function as shown in the example below:

SELECT DATE_FORMAT(field name, '%d/%m/%Y') FROM tablename

SELECT DATE_FORMAT(column_name, '%m/%d/%Y') FROM tablename

No comments: