Scalar Functions — DateTime
KQL has a rich set of datetime functions for bucketing, truncating, formatting, and converting timestamps. Most functions work across all five dialects. The remaining gaps are approximations where a dialect lacks a native interval/timespan type — notably totimespan() in SQLite and MySQL, and datetime_add() with non-literal amounts in SQLite.
Legend: ✅ Supported · ⚠️ Approximated · ❌ Not Supported · 🔄 Rewritten
| Function | SQLite | MySQL | ClickHouse | PostgreSQL | DuckDB | Notes |
|---|---|---|---|---|---|---|
now() | ✅ | ✅ | ✅ | ✅ | ✅ | SQLite: datetime('now') |
ago(duration) | ✅ | ✅ | ✅ | ✅ | ✅ | All units supported; sub-second normalized to seconds |
datetime(val) | ✅ | ✅ | ✅ | ✅ | ✅ | CAST to timestamp; MySQL: DATETIME |
todatetime() |