Which date-times do the text values hold?
Tableau
DATETIME([Text])SQL (DuckDB)
SELECT
coalesce(try_cast(Text AS TIMESTAMP), try_strptime(Text, '%B %d, %Y'), try_strptime(Text, '%m/%d/%Y')) AS result
FROM input
ORDER BY idRow 3 keeps its 10:15; the other dates get midnight. Rows 7 and 8 aren't dates and return null.
| Text | Result |
|---|---|
| 2021-01-01 | 2021-01-01 00:00 |
| January 3, 2021 | 2021-01-03 00:00 |
| 2024-02-29 10:15 | 2024-02-29 10:15 |
| 2024-12-29 | 2024-12-29 00:00 |
| 12/30/2024 | 2024-12-30 00:00 |
| 2025-01-31 | 2025-01-31 00:00 |
| 2025-02-29 | null |
| n/a | null |
| null |
The Tableau formula and the SQL return the same 9 rows.