Syntax\n------\n\nTO_DATE(string_expression [DEFAULT string_expression ON CONVERSION ERROR],\n        format_string [,NLS_FORMAT_STRING])\n\nDescription\n-----------\n\nTO_DATE was added for Oracle support.\n\n format_string has the same format elements as TO_CHAR(), except a few elements that are not supported (see below). TO_DATE() returns a datetime value.\n The allowed separators are the same as for TO_CHAR(): space ( ), tab (\\t), and any of !, #, %, ', (, ), , +, -, ., /, :, ;, <, =, or >.\n & can be used if the next character is not a character in the a-z or A-Z range. text indicates a text string that is used verbatim in the format. You cannot use the double-quote (") as a separator.\n NLS_FORMAT_STRING supports these options: NLS_CALENDAR=GREGORIAN and NLS_DATE_LANGUAGE=_language_, where _language_ can be one of the following:\n   All MariaDB short locales, like en_AU.\n   The following Oracle language names: ALBANIAN, AMERICAN, ARABIC, BASQUE, BELARUSIAN, BRAZILIAN PORTUGUESE, BULGARIAN, CANADIAN FRENCH, CATALAN, CROATIAN, CYRILLIC SERBIAN, CZECH, DANISH, DUTCH, ENGLISH, ESTONIAN, FINNISH, FRENCH, GERMAN, GREEK, HEBREW, HINDI, HUNGARIAN, ICELANDIC, INDONESIAN, ITALIAN, JAPANESE, KANNADA, KOREAN, LATIN AMERICAN SPANISH, LATVIAN, LITHUANIAN, MACEDONIAN, MALAY, MEXICAN SPANISH, NORWEGIAN, POLISH, PORTUGUESE, ROMANIAN, RUSSIAN, SIMPLIFIED CHINESE, SLOVAK, SLOVENIAN, SPANISH, SWAHILI, SWEDISH, TAMIL, THAI, TRADITIONAL CHINESE, TURKISH, UKRAINIAN, VIETNAMESE\n\nSupported Format Elements\n\n AD – Anno Domini ("in the year of the Lord")\n AD_DOT – Anno Domini ("in the year of the Lord")&#x20;\n AM – Meridian indicator (before midday)\n AM_DOT – Meridian indicator (before midday)\n DAY – Name of day\n DD – Day (1-31)\n DDD – Day of year (1-336)\n DY – Abbreviated name of day\n FF[1-6] – Fractional seconds\n HH – Hour (1-12)\n HH12 – Hour (1-12)\n HH24 – Hour (0-23)\n MI – Minutes (0-59)\n MM – Month (1-12)\n MON – Abbreviated name of month\n MONTH – Name of Month\n PM – Meridian indicator (after midday)\n PM_DOT – Meridian indicator (after midday)\n RR – 20th century dates in the 21st century. 2 digits in the 50-99 range are assumed starting from the year 2000, and 0-49 is assumed from 1900.&#x20;\n RRRR – 20th century dates in the 21st century. 4 digits\n SS – Seconds\n SYYYY – Signed 4-digit year; MariaDB only supports positive years\n Y – 1-digit year\n YY – 2-digit year\n YYY – 3-digit year\n YYYY – 4 digit year\n\nIf no datetime is given, the current datetime is used. For example, if 'MM-DD HH-MM-SS' is given, the current year is used. (This is Oracle behavior.)\n\nUnsupported Options\n\n BC, D, DL, DS, E, EE, FM, FX, RM, SSSSS, TS, TZD, TZH, TZR, X, and SY BC are not supported by MariaDB datetime.\n Most other formats do not make sense in a MariaDB context, as we return  datetime with fractions, not as a string.\n D (day-of-week) is not supported as it is not clear how it would map to MariaDB. This element depends on the NLS territory of the session.\n RR only works with 2-digit years. (In Oracle, RR may also work with 4-digit years in some context, but the rules are not clear.)\n\nExtensions and Differences Compared to Oracle\n\n MariaDB supports FF (fractional seconds). If FF[#] is used, TO_DATE  returns a datetime with # of subseconds. If FF is not used, a datetime is returned. A warning (but no error) is issued if the string contains more digits than specified with F(#].\n Names can be shortened to their unique prefixes. For example, both January and Ja work fine.\n No error is issued if the datetime string is shorter than format_string and the next unused character is not a number. This is useful to get a datetime from a mixed set of strings in datetime format. By contrast, Oracle gives an error if the datetime string is too short.\n MariaDB supports short locales as language names.\n NLS_DATE_FORMAT can use double-quote (") and single-quote (') for quoting.\n* NLS_DATE_FORMAT must be a constant string. This is to ensure that the server knows which locale to use when executing the function.\n\nExamples\n--------\n\nSELECT TO_DATE('February 5, 2026, 20:56','%Y-%m-%e')\n+-----------------------------------------------+\n| TO_DATE('February 5, 2026, 20:56','%Y-%m-%e') |\n+-----------------------------------------------+\n| 2026-02-05                                    |\n+-----------------------------------------------+\n\nURL: https://mariadb.com/docs/server/reference/sql-functions/date-time-functions/to_date