Home >Database >Mysql Tutorial >How Can I Format MySQL Dates as DD/MM/YYYY?
Change Date Format to DD/MM/YYYY in MySQL
When working with MySQL, retrieving dates in the format 'YYYY-MM-DD' can be inconvenient. This article provides several methods to transform dates into the desired 'DD/MM/YYYY' format.
PHP Solutions:
Using strtotime() and date():
Using DateTime Class:
MySQL Solution:
Using date_format() Function:
For example, the following MySQL query would display the current date in 'd/m/Y' format:
mysql> select date_format(curdate(), '%d/%m/%Y');
The above is the detailed content of How Can I Format MySQL Dates as DD/MM/YYYY?. For more information, please follow other related articles on the PHP Chinese website!