FAQs Categories
Client Server Commands
Database Structure
Table Types or Storage Engines
SQL Statements
Table Joins
Funtions and Operators
Tricky Select Queries
Speed Up Queries
Data Back Up
General Questions
1PLs Company - #1Payday.Loans Agency - Loans online and near me $100-$2500 (Same Day)
Powered by MySQL
Home / Database Structure / Data Types / Question No: 110

How to reformat date values in MySQL?

I want to reformat MySQL date values into other display formats.  Is there any function?

Answer No: 110

You can reformat date values into other display formats using the MySQL DATE_FORMAT() function.  Take Example:
SELECT DATE_FORMAT('1997-10-04 22:23:00', '%W %M %Y'); 
-> 'Saturday October 1997'
SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H:%i:%s'); -> '22:23:00'
SELECT DATE_FORMAT('1997-10-04 22:23:00', '%D %y %a %d %m %b %j');
-> '4th 97 Sat 04 10 Oct 277'
SELECT DATE_FORMAT('1997-10-04 22:23:00', '%H %k %I %r %T %S %w');
-> '22 22 10 10:23:00 PM 22:23:00 00 6'
SELECT DATE_FORMAT('1999-01-01', '%X %V'); -> '1998 52'

Related MySQL FAQs to the Above FAQ

What-is-BIT-Data-Type-in-MySQL What is BIT Data Type in MySQL?

What-are-numeric-data-types-in-MySQL What are numeric data types in MySQL?

What-are-integer-data-types-in-MySQL What are integer data types in MySQL?

What-are-float-data-types-in-MySQL What are float data types in MySQL?

What-is-fixed-point-and-decimal-data-type-in-MySQL What is fixed point and decimal data type in MySQL?

What-is-MySQL-default-character-set What is MySQL default character set?

What-is-difference-between-binary-and-non-binary-string-data-types What is difference between binary and non-binary string data types?

What-are-ENUM-and-SET-Data-Types-in-MySQL What are ENUM and SET Data Types in MySQL?

What-is-difference-between-CHAR-AND-VARCHAR-data-types What is difference between CHAR AND VARCHAR data types?

What-are-string-data-types-in-MySQL-5 What are string data types in MySQL 5?

How-to-reformat-Time-values-in-MySQL How to reformat Time values in MySQL?

What-are-Temporal-Data-Types-in-MySQL What are Temporal Data Types in MySQL?

What-are-DATE-TIME-DATETIME-and-YEAR-Data-Types-in-MySQL What are DATE, TIME, DATETIME and YEAR Data Types in MySQL?

What-is-TIMESTAMP-Data-Type-in-MySQL What is TIMESTAMP Data Type in MySQL?

About FAQs: Recently Added FAQs

About MySQL FAQs: Site Map | Bookmark Us | Recommend this Site to Your Friend | Contact Us

Useful Links: | | | |

© 2023
All rights reserved.