
- 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
How to convert MM/YY to YYYY-MM-DD in MYSQL?
To convert, use str_to_date() in MySQL
Let us create a table and add date records −
Example
mysql> create table demo72 -> ( -> due_date varchar(40) -> ); Query OK, 0 rows affected (2.96 sec)
Insert some records into the table with the help of insert command −
Example
mysql> insert into demo72 values("11/15"); Query OK, 1 row affected (0.26 sec) mysql> insert into demo72 values("02/20"); Query OK, 1 row affected (0.09 sec) mysql> insert into demo72 values("07/95"); Query OK, 1 row affected (0.15 sec)
Display records from the table using select statement −
Example
mysql> select *from demo72;
This will produce the following output −
Output
+----------+ | due_date | +----------+ | 11/15 | | 02/20 | | 07/95 | +----------+ 3 rows in set (0.00 sec)
Following is the query to convert MM/YY to YYYY-MM-DD in MySQL.
Example
mysql> select str_to_date(concat('10/', due_date), '%d/%m/%y') as original_date -> from demo72;
This will produce the following output −
Output
+---------------+ | original_date | +---------------+ | 2015-11-10 | | 2020-02-10 | | 1995-07-10 | +---------------+ 3 rows in set (0.00 sec)
- Related Articles
- How to convert MM/YY to YYYY-MM-DD with a specific day in MySQL?
- Convert MySQL date format from yyyy-mm-ddThh:mm:ss.sssZ to yyyy-mm-dd hh:mm:ss ?
- Convert MM/DD/YY to Unix timestamp in MySQL?
- MySQL - Convert YYYY-MM-DD to UNIX timestamp
- MySQL query to convert YYYY-MM-DD to DD Month, YYYY date format
- How to convert date YYYYMMDD to YY-MM-DD in MySQL query?
- Convert dd/mm/yyyy string to Unix timestamp in MySQL?
- MySQL date format to convert dd.mm.yy to YYYY-MM-DD?
- How to parse Date from String in the format: dd/MM/yyyy to dd/MM/yyyy in java?
- How to Convert YYYY-MM-DD to Standard Date in Excel?
- How to insert mm/dd/yyyy format dates in MySQL?
- How to convert Python date string mm/dd/yyyy to datetime?
- MySQL date format DD/MM/YYYY select query?
- How to format JavaScript date into yyyy-mm-dd format?
- Get date format DD/MM/YYYY with MySQL Select Query?

Advertisements