Description | The |
Syntax | TO_DATETIME( |
Output | datetime |
Variables
text: The text data representing the datetime that you want to convert into a datetime format. It should be in a recognizable datetime format, such as "YYYY-MM-DD HH:MM:SS."[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_DATETIME(CONCAT(TO_DATE(Registration Date`)," ",Registration Time`))
Name | Registration Date | Registration Time | TO_DATETIME |
Giacomo | April 22, 2024 | 20:21:42 | 2024-04-22T16:21:42000-04:00 |
Kameko | May 22, 2024 | 11:30:38 | 2024-05-22T07:30:38000-04:00 |
Anne | May 3, 2024 | 13:11:30 | 2024-05-03T09:11:30000-04:00 |
Orlando | July 25, 2024 | 2:29:42 | 2024-07-24T22:29:42000-04:00 |
Nasim | December 11, 2023 | 13:29:58 | 2023-12-11T08:29:58000-05:00 |
