SQL tool

SQL Date Filter Generator

Build last 30 days, today, yesterday, current month or custom range queries for date columns such as CreateDate in seconds.

Filter settingsDatabase, column and date range
Quick example
SQL outputChanges are applied instantly.

Practical guide

Generate database-specific SQL date conditions instantly

Choose a column, table, database and time range to generate condition, WHERE and sample SELECT output for the last 30 days, today, yesterday, current month or a custom range.

What is an SQL Date Filter Generator?

This tool streamlines workflows such as listing orders from the last 30 days and filtering today's log records in one place.

How to use it

  1. Choose the database and date column.
  2. Choose last N units, a day, month or custom range.
  3. Copy the condition, WHERE or SELECT output.

Common uses

  • Listing orders from the last 30 days
  • Filtering today's log records
  • Preparing last month's report
  • Finding records between two dates

Practical examples

SQL Server last 30 days

Automatically generate CreateDate >= DATEADD(DAY, -30, GETDATE()).

PostgreSQL current month

Generate a sargable range using date_trunc for the month boundary.

Custom reporting range

Build a safe range that includes the start and excludes the end.

Frequently asked questions

Why is the column not wrapped in CAST?

Wrapping a column in a function can prevent index usage, so the tool calculates boundary values where possible.

Which databases are supported?

It generates suitable date functions for SQL Server, PostgreSQL, MySQL and SQLite.

Is the SQL executed?

No. It only generates query text and never connects to your database.