
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
MySQL query to convert YYYY-MM-DD to DD Month, YYYY date format
Let us first create a table −
mysql> create table DemoTable845(AdmissionDate date); Query OK, 0 rows affected (1.10 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable845 values('2018-01-21'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable845 values('2016-12-12'); Query OK, 1 row affected (0.13 sec) mysql> insert into DemoTable845 values('2019-08-05'); Query OK, 1 row affected (0.44 sec) mysql> insert into DemoTable845 values('2019-10-15'); Query OK, 1 row affected (0.19 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable845;
This will produce the following output −
+---------------+ | AdmissionDate | +---------------+ | 2018-01-21 | | 2016-12-12 | | 2019-08-05 | | 2019-10-15 | +---------------+ 4 rows in set (0.00 sec)
Following is the query to convert YYYY-MM-DD to DD Month, YYYY date format −
mysql> select date_format(AdmissionDate,'%e %M, %Y') from DemoTable845;
This will produce the following output −
+----------------------------------------+ | date_format(AdmissionDate,'%e %M, %Y') | +----------------------------------------+ | 21 January, 2018 | | 12 December, 2016 | | 5 August, 2019 | | 15 October, 2019 | +----------------------------------------+ 4 rows in set (0.00 sec)
- Related Articles
- MySQL date format DD/MM/YYYY select query?
- Convert MySQL date format from yyyy-mm-ddThh:mm:ss.sssZ to yyyy-mm-dd hh:mm:ss ?
- MySQL date format to convert dd.mm.yy to YYYY-MM-DD?
- Get date format DD/MM/YYYY with MySQL Select Query?
- How to parse Date from String in the format: dd/MM/yyyy to dd/MM/yyyy in java?
- How to format JavaScript date into yyyy-mm-dd format?
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- Java Program to format date in mm-dd-yyyy hh:mm:ss format
- How to convert MM/YY to YYYY-MM-DD in MYSQL?
- How to insert mm/dd/yyyy format dates in MySQL?
- Program to reformat date in YYYY-MM-DD format using Python
- Accepting date strings (MM-dd-yyyy format) using Java regex?
- How to convert Python date string mm/dd/yyyy to datetime?
- How to Convert YYYY-MM-DD to Standard Date in Excel?
- Get today's date in (YYYY-MM-DD) format in MySQL?

Advertisements