Description | The |
Syntax | TO_DATE( |
Output | date |
Variables
text: The text data representing the date that you want to convert into a date format. It should be in a recognizable date format, such as "YYYY-MM-DD" or "MM/DD/YYYY."[format]: Optional. TellsTO_DATE()exactly how to interpret the input text. You can often omit this argument when the date is in a common recognizable format and can be auto-parsed correctly.
β
Use[format]when the input could be interpreted more than one way, does not follow a standard format, includes text-based components (ex: month names), or when you want to guarantee consistent parsing. For example,"dd/MM/yyyy"ensures"03/04/2025"is interpreted as 3 April 2025, not March 4, 2025.
You can build a format pattern using a combination of symbols (ex:yyyy,MM,dd) and literal separators (ex: spaces, commas, slashes, and dashes). The pattern must match the structure of the input text. Supported format symbols are listed below, and symbol capitalization matters. For example,MMrepresents a month, whilemmrepresents minutes, so using the wrong capitalization can result in incorrect parsing.
A common mistake is usingYYYY(uppercase), which represents a week-based year and can produce unexpected results near year boundaries. Always use lowercaseyyyyfor calendar year. Additionally, when parsingyy(2-digit year), the year is interpreted relative to a century window. Dates are adjusted to fall within 80 years before and 20 years after the time of calculation. For example, if the calculation runs on3/25/2026,3/24/46is parsed as3/24/2046and3/26/46is parsed as3/26/1946.
Savant format patterns follow standard Unicode (CLDR) and Java date/time conventions.
Symbol | Meaning | Example |
| Year (4 digit) | 2025 |
| Year (2 digit) | 25 |
| Month number | 03 |
| Month short | Mar |
| Month full | March |
| Day of month | 15 |
| Weekday short | Sat |
| Weekday full | Saturday |
| Hour (24h) | 14 |
| Hour (12h) | 02 |
| Minute | 30 |
| Second | 45 |
| AM/PM | PM |
| Quarter | 1 |
Example
TO_DATE(`DOB`)
Name | DOB | TO_DATE(`DOB`) |
Giacomo | 2/15/1983 | 1983-02-15 |
Kameko | 4/19/1969 | 1969-04-19 |
Anne | 2/06/2012 | 2012-02-06 |
Orlando | 4/28/1988 | 1988-04-28 |
Nasim | 3/02/2007 | 2007-03-02 |
