Home >Database >Mysql Tutorial >How to convert mysql string to date
How to convert mysql string to date: First log in to mysql in cmd and enter the relevant code to obtain the [yyyy-MM-dd] format; then abbreviate the middle part of the date string and connect the date characters with dots String; enter the last statement to get the date.
【Related learning recommendations: mysql tutorial(Video)】
How to convert mysql string to date:
1. First log in to mysql in cmd, as shown in the figure below
2. Enter select str_to_date('08/09/2020', '%m/%d/%Y')
to get the yyyy-MM-dd format, as shown below As shown
3, the year part of the date string can also be abbreviated, as shown below
4 , In addition, date strings can also be connected with dots, as shown in the figure below
5, and then enter select str_to_date('01:07:30', '% h:%i:%s')
Get the hour, minute and second, as shown in the figure below
#6. Finally, you can also convert the string of year, month, day, hour, minute and second, As shown in the picture below
If you want to know more about programming learning, please pay attention to the php training column!
The above is the detailed content of How to convert mysql string to date. For more information, please follow other related articles on the PHP Chinese website!