
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Use MySQL STR_TO_DATE Function for Column Input Format
STR_TO_DATE() function will convert a string value into datetime value and it would be according to a specific format string. Both string value and format string must be passed as arguments to the function. Following is the syntax of STR_TO_DATE() function.
STR_TO_DATE(string, format)
Here string is the value of string which needs to be converted to datetime value and format is the specified date format.
The following example will return valid date from given string and according to the specified format.
mysql> Select STR_TO_DATE('20172810', '%Y%d%m'); +-----------------------------------+ | STR_TO_DATE('20172810', '%Y%d%m') | +-----------------------------------+ | 2017-10-28 | +-----------------------------------+ 1 row in set (0.00 sec)
Advertisements