Home  >  Article  >  Database  >  How to convert mysql string to date

How to convert mysql string to date

coldplay.xixi
coldplay.xixiOriginal
2020-09-03 11:20:1834140browse

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.

How to convert mysql string to 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

How to convert mysql string to date

2. Enter select str_to_date('08/09/2020', '%m/%d/%Y') to get the yyyy-MM-dd format, as shown below As shown

How to convert mysql string to date

3, the year part of the date string can also be abbreviated, as shown below

How to convert mysql string to date

4 , In addition, date strings can also be connected with dots, as shown in the figure below

How to convert mysql string to date

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

How to convert mysql string to date

#6. Finally, you can also convert the string of year, month, day, hour, minute and second, As shown in the picture below

How to convert mysql string to date

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more