DATE(timestamp_expression, time_zone) is transpiled to STRPTIME(...), treating the time zone as a format string.
Version: @polyglot-sql/sdk 0.12.1, DuckDB 1.5.5
Repro
import { transpile, Dialect } from '@polyglot-sql/sdk';
transpile(
"SELECT DATE(TIMESTAMP '2026-01-31 23:30:00+00', 'Europe/Berlin') AS d",
Dialect.BigQuery,
Dialect.DuckDB,
).sql[0];
Actual
SELECT CAST(STRPTIME(CAST('2026-01-31 23:30:00+00' AS TIMESTAMPTZ), 'Europe/Berlin') AS DATE) AS d
DuckDB: Binder Error: No function matches the given name and argument types 'strptime(TIMESTAMP WITH TIME ZONE, STRING_LITERAL)'
Expected
The two-argument form converts the timestamp to the given time zone before taking the date. BigQuery returns 2026-02-01. For reference, sqlglot emits:
SELECT CAST(CAST(CAST('2026-01-31 23:30:00+00' AS TIMESTAMPTZ) AS TIMESTAMP) AT TIME ZONE 'UTC' AT TIME ZONE 'Europe/Berlin' AS DATE) AS d
DATE(timestamp_expression, time_zone)is transpiled toSTRPTIME(...), treating the time zone as a format string.Version:
@polyglot-sql/sdk0.12.1, DuckDB 1.5.5Repro
Actual
DuckDB:
Binder Error: No function matches the given name and argument types 'strptime(TIMESTAMP WITH TIME ZONE, STRING_LITERAL)'Expected
The two-argument form converts the timestamp to the given time zone before taking the date. BigQuery returns
2026-02-01. For reference, sqlglot emits: