Convert mysqlstr_to_date string to datetime _ MySQL

Source: Internet
Author: User
Convert mysqlstr_to_date string to date bitsCN.com

Mysql str_to_date string to date

Mysql built-in functions use str_to_date () in mysql to convert a string to a date.

Instance:

The separators are the same, and the year, month, and day must be the same.

Select str_to_date ('2014/1/0 12:00:34 AM ',' % m/% d/% y % h: % I: % s % S') as column_name from table_name;

Str_to_date ('2014/1/123', '% m/% d/% Y'); --

Str_to_date ('2014/1/11', '% m/% d/% Y'); -- 11/09

Str_to_date ('11. 09.2011 ',' % m. % d. % Y'); -- 2011-11-09

Str_to_date ('11: 09: 30', '% h: % I: % S'); -- 11:09:30

Str_to_date ('11. 09.2011 11:09:30 ',' % m. % d. % Y % h: % I: % S'); -- 11:09:30

BitsCN.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.