Natural-language dates

functional

Type last wed at 3, november or ytd after a date comparison and SQLly writes the exact literal or range, and keeps it current.

Date filters are where SQL gets fiddly. Is the last day of the month the 30th or the 31st? Does BETWEEN catch the afternoon of the last day? Which date was "last Wednesday"? SQLly lets you type the date the way you would say it and writes the exact literal for you, in the column's own precision and the engine's own spelling.

Typing a date in plain words

Start a comparison on a date column, such as WHERE OrderDate = or AND created_at >=, and press Ctrl+Shift+Space. A card opens under the line. It doesn't list suggestions; it tells you what you can type. Type a phrase and the card shows what it means and the SQL it will become. Press Enter (or Tab) to write it, or Esc to cancel.

SELECT *
FROM Sales.Orders AS o
WHERE o.OrderDate = last wed at 3

becomes

WHERE o.OrderDate = '2026-10-21T15:00:00' --sqlly date:last wed at 3
SQLly
The date card under a WHERE comparison: the phrase typed in plain words, what it means, and the SQL literal it will become.The date card under a WHERE comparison: the phrase typed in plain words, what it means, and the SQL literal it will become.
The date card under a WHERE comparison: the phrase typed in plain words, what it means, and the SQL literal it will become.

You can also type the phrase first and press Ctrl+Shift+Space afterwards; the card opens with it already read. Anywhere that isn't a date comparison, the shortcut still looks up the column's real values, as before.

Periods become ranges

A phrase that names a whole period, such as today, november, last week or ytd, is turned into a range so the comparison covers all of it. The operator decides how:

=
The whole period: OrderDate BETWEEN '2025-11-01' AND '2025-11-30'.
<>
Everything outside it: NOT BETWEEN.
> and <=
Compared with the period's last moment, so > november means after November.
>= and <
Compared with the period's first moment, so < november means before November.

The end of a BETWEEN is written at the last moment the column can store, so nothing slips through: '2025-11-30' for a date column, '2025-11-30T23:59:59.997' for SQL Server datetime, '2025-11-30T23:59:59.9999999' for datetime2, and the matching precision for PostgreSQL, MySQL, SQLite and Oracle (which also gets its DATE/TIMESTAMP literal keywords). Prefer exact half-open ranges? Switch the range style and = november becomes (OrderDate >= '2025-11-01' AND OrderDate < '2025-12-01').

What you can type

Days
now, today, yesterday, tomorrow, the day before yesterday, wed, last friday, next monday, monday last week
Times
at 3, 3pm, 15:30, noon, midnight, yesterday at noon, tomorrow morning, last night, end of day
Periods
this week, last month, next quarter, this year, last weekend, q3 2025, november, nov 2024, 2024
To date
ytd, mtd, qtd, wtd, year to date, this month so far, since march
Rolling windows
past 7 days, last 3 months, past 24 hours, the last few days, next 2 weeks
Offsets
3 days ago, a week ago, in 2 weeks, 10 days from now, 3 days before christmas
Dates
nov 5, november 5th 2024, 5th of november, the 5th, 2024-11-05, 11/5/2024, nov 5 at 3:15pm
Boundaries
start of this week, end of last month, first day of next month, last friday of the month
Ranges
from mon to fri, between jan and mar 2024, jan - mar, oct 1 through oct 15
Fiscal years
this fiscal year, last fiscal year, fytd, fy2025
Holidays
christmas, new year's day, thanksgiving, labor day, memorial day, july 4th, halloween

If the card can't read what you typed, it says so and shows examples; Enter waits until the phrase reads as a date.

Keeping dates current

The --sqlly date: comment keeps your words next to the literal. That matters for saved queries: a query you wrote for "yesterday" should mean yesterday every time you open it.

SQLly
A written date literal with its trailing --sqlly date: comment and the refresh button that re-evaluates it against today.A written date literal with its trailing --sqlly date: comment and the refresh button that re-evaluates it against today.
A written date literal with its trailing --sqlly date: comment and the refresh button that re-evaluates it against today.
  • Click the ↻ after a comment to re-evaluate that one date against today.
  • A statement that holds any of these dates shows a ↻ Refresh dates button on its first line, which re-evaluates all of them in one undoable edit.
  • Run Refresh Natural-Language Dates from the command palette to update every date in the query.
  • Or turn on Refresh dates every time the query runs and never think about it again.

Because a -- comment runs to the end of the line, anything that followed the phrase on the same line moves to the next line, at the same indent.

Settings

Everything lives under Settings › Editor › IntelliSense › Date & time convenience:

Read dates typed in plain words
Turns the feature on or off. Off, Ctrl+Shift+Space always looks up column values.
Turn periods into ranges
Off, a period means its first moment (= november becomes = '2025-11-01').
Range style
BETWEEN start AND end (default) or the exact (>= start AND < next).
A day or month on its own
Whether wed or november means the most recent one (default), the next one, or this week's / this year's.
Weeks start on
Sunday (default) or Monday, for this week and last week.
A time without am/pm
Business hours (default: at 3 is 3:00 PM, 1 to 7 are afternoon) or a 24-hour clock.
To-date periods end
At the end of today (default) or right now, for ytd, past 7 days and the like.
Fiscal year starts in
The month your fiscal year begins. A fiscal year is named for the calendar year it ends in.
Keep what I typed in a --sqlly date: comment
Off, only the literal is written, and it can't be refreshed later.
Show refresh buttons
The ↻ after each comment and the Refresh dates button on the statement.
Refresh dates every time the query runs
Re-evaluates every marked date just before the query runs. Off by default.
Treat columns named like dates as dates
When the data model doesn't know a column's type (no connection yet, for example), names such as OrderDate, created_at or ModifiedOn count as dates.