How To Change Date Format in MySQL Query?
Hi friends,
I am going to explain you example of how to change date format in MySQL query?. You will learn MySQL date format DD/MM/YYYY select query?. In side this article we will see the MySQL date format to convert dd.mm.yy to YYYY-MM-DD?.
This article will give you simple example of how to change datetime formats in MySQL. We will use get search MySQL DATE_FORMAT Function: Format Dates in MySQL.
So let's start following example.
Table : user_payments
Solution SQL Query : 1
SELECT
*, DATE_FORMAT(payment_date,'%d/%m/%Y') as new_payment_date
FROM `user_payments`
Output:
Solution SQL Query : 2
SELECT
*, DATE_FORMAT(payment_date,'%m/%d/%Y') as new_payment_date
FROM `user_payments`
Output:
I hope it will help you...
- How to Increase max_connections in MySQL?
- How to Install the PHP PDO MySQL Extension on Ubuntu 22.04?
- How to Install PHP MySQL on Linux Ubuntu?
- How to Install LEMP Stack Nginx, MySQL, PHP on Ubuntu?
- How to Change MySQL Root User Password Ubuntu?
- PHP 8 MySQL Form Validation Example
- How to Select First Row Only in PHP MySQL?
- How To Backup MySQL Database Using PHP Example