Home >Database >Mysql Tutorial >How to convert a string into formatted date and time in MySQL

How to convert a string into formatted date and time in MySQL

王林
王林forward
2023-06-01 21:22:051049browse

STR_TO_DATE(date, format): Convert a string into a date and time in format format

SELECT STR_TO_DATE(‘2015-01-01', ‘%Y-%m-%d')
-> 2015-01-01

The above is the detailed content of How to convert a string into formatted date and time in MySQL. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:yisu.com. If there is any infringement, please contact admin@php.cn delete