STR_TO_DATE_DATE()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Parses a string argument using the supplied format and returns a DATE
value.
USAGE
STR_TO_DATE_DATE(string, format)
Argument Name | Description |
---|---|
| The string to parse |
| A specification of how to parse the data out of the string |
DETAILS
STR_TO_DATE_DATE()
is a date-time function that converts a string into a date value based on a restricted parsing order specified in the format
argument.
Spaces specified in the string and the format are matched loosely, while other non-escape characters in the format string are required to exist in the source string.
A NULL
is returned if any argument is NULL
.
Option | Description |
---|---|
| Abbreviated weekday name in the current locale |
| Abbreviated month name in the current locale |
| Month number in 1 or 2 digits |
| Day number with English suffix "st", "nd", "rd", or "th" |
| Day number in 2 digits |
| Day number in 1 or 2 digits |
| Numeric day of the year in 3 digits (001-366) |
| Full month name in the current locale |
| Month number in 2 digits |
| Week number (00-53) starting on Sunday |
| Week number (00-53) starting on Monday |
| Week number (01-53) starting on Sunday |
| Week number (01-53) starting on Monday |
| Full weekday name in current locale |
| Day of the week (Sunday is 0) |
| Year with 4 digits according to |
| Year with 4 digits according to |
| Year with 4 digits |
| Year with 2 digits |
| A literal |
EXAMPLES
SELECT STR_TO_DATE_DATE('01,02,2020', '%d,%m,%Y') AS result;
+------------+
| result |
+------------+
| 2020-02-01 |
+------------+
SELECT STR_TO_DATE_DATE('September 1, 2019 11:30',
'%M %d,%Y %h:%i') AS result;
+------------+
| result |
+------------+
| 2019-09-01 |
+------------+