About

About

Cross-dialect SQL date recipes — by someone who keeps switching between Postgres, BigQuery and Snowflake and re-learning the date functions each time.

Date and time handling is where SQL dialects diverge the most: different function names, different argument orders, different defaults for the start of the week, and missing builtins. This site puts the same task side by side — MySQL, PostgreSQL, BigQuery, Snowflake, SQLite and DuckDB — so you copy the version for your engine and move on, with a note on the per-dialect gotcha that silently changes the answer.

Queries target current versions of each engine. Where a dialect has no clean builtin (e.g. MySQL has no DATE_TRUNC, SQLite has no native interval math), the recipe gives the correct, runnable workaround and says so — nothing is faked.

Topics: current date/time, casting and formatting, add/subtract intervals, date difference, age, DATE_TRUNC and EXTRACT, day-of-week, first/last day of month, generate series, group-by-month, Unix timestamps, and time-zone conversion.