Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
STR_ TO_ DATE
On this page
The STR_ function extracts datetime value from input string according to a specified format.
Syntax
STR_TO_DATE (str, format)Arguments
-
str: a valid date, datetime, or time, formatted according to the specified format string
-
format: a string containing format symbols
See DATE_
Return Type
String
Examples
SELECT STR_TO_DATE('March 3rd, 2015', '%M %D, %Y');
+---------------------------------------------+
| STR_TO_DATE('March 3rd, 2015', '%M %D, %Y') |
+---------------------------------------------+
| 2015-03-03 |
+---------------------------------------------+SELECT STR_TO_DATE('2015-03-03 11:37:07', '%Y-%m-%d %h:%i:%s');
+---------------------------------------------------------+
| STR_TO_DATE('2015-03-03 11:37:07', '%Y-%m-%d %h:%i:%s') |
+---------------------------------------------------------+
| 2015-03-03 11:37:07 |
+---------------------------------------------------------+SELECT STR_TO_DATE('Tuesday, the 3rd day of March in that remarkable year 2015', '%W, the %D day of %M in that remarkable year %Y') AS florid;
+------------+
| florid |
+------------+
| 2015-03-03 |
+------------+Last modified: