ISDATE(string) returns true when the string is a valid date in a format Tableau recognises, and false otherwise, including for null. It accepts the same formats as DATE: "2021-01-01", "January 3, 2021", "12/30/2024" in a US English locale. DuckDB has no ISDATE; test whether the parse is non-null.
Updated · Checked on the xmetric engine
What is the syntax?
ISDATE(string)
string
a string. Date fields are not allowed.
Returns a boolean: true if the string is a valid date. False for null.
What does it return, and what is the SQL?
Each example runs on the same 9 sample rows twice: the Tableau formula on the xmetric engine, and the SQL in DuckDB.
Which text values are valid dates?
Tableau
ISDATE([Text])
SQL (DuckDB)
SELECTcoalesce(try_cast(Text AS DATE), CAST (try_strptime(Text, '%B %d, %Y') AS DATE), CAST (try_strptime(Text, '%m/%d/%Y') AS DATE)) ISNOTNULLAS result
FROM input
ORDERBY id
Rows 1 to 6 are dates in four formats; "2025-02-29", "n/a" and the blank are not.
Text
Result
2021-01-01
true
January 3, 2021
true
2024-02-2910:15
true
2024-12-29
true
12/30/2024
true
2025-01-31
true
2025-02-29
false
n/a
false
false
✓ The Tableau formula and the SQL return the same 9 rows.
How do I convert only the valid ones?
Tableau
IIF(ISDATE([Text]), DATE([Text]), NULL)
SQL (DuckDB)
SELECTcoalesce(try_cast(Text AS DATE), CAST (try_strptime(Text, '%B %d, %Y') AS DATE), CAST (try_strptime(Text, '%m/%d/%Y') AS DATE)) AS result
FROM input
ORDERBY id
DATE already returns null for invalid text, so in SQL the parse alone does it.
Text
Result
2021-01-01
2021-01-01
January 3, 2021
2021-01-03
2024-02-2910:15
2024-02-29
2024-12-29
2024-12-29
12/30/2024
2024-12-30
2025-01-31
2025-01-31
2025-02-29
null
n/a
null
null
✓ The Tableau formula and the SQL return the same 9 rows.
Where does a straight translation go wrong?
Common mistake
Why does try_cast(Text AS DATE) IS NOT NULL reject real dates?
DuckDB casts only ISO text, so "January 3, 2021" and "12/30/2024" fail the cast. Tableau recognises both. Try each format you expect.
Tableau
ISDATE([Text])
Tempting SQL
SELECTtry_cast(Text AS DATE) ISNOTNULLAS result
FROM input
ORDERBY id
SQL that matches
SELECTcoalesce(try_cast(Text AS DATE), CAST (try_strptime(Text, '%B %d, %Y') AS DATE), CAST (try_strptime(Text, '%m/%d/%Y') AS DATE)) ISNOTNULLAS result
FROM input
ORDERBY id
Text
Tableau
Tempting SQL
SQL that matches
2021-01-01
true
true
true
January 3, 2021
true
false
true
2024-02-2910:15
true
true
true
2024-12-29
true
true
true
12/30/2024
true
false
true
2025-01-31
true
true
true
2025-02-29
false
false
false
n/a
false
false
false
false
false
false
✓ The SQL that matches returns the Tableau result on every row; the marked cells are where the tempting SQL differs.
How do I write it in Snowflake or BigQuery?
The first example, written for each warehouse from its documentation. These are not run here; DuckDB is.
Snowflake
SELECTTRY_TO_DATE(Text) ISNOTNULLAS result
FROM input
ORDERBY id