SQL WHERE Date Is Today: Syntax and Examples

By Dr. Zubair Khalid, DVM, MS, PhD ·

SQL WHERE Date Is Today: Syntax and Examples

To filter rows where a date column equals today, compare the column to the current date function in your database. In standard SQL and PostgreSQL you write WHERE date_column = CURRENT_DATE. In SQL Server you write WHERE date_column = CAST(GETDATE() AS DATE). In SQLite you write WHERE date(order_date) = date('now'). The rest of this article shows each form, a worked example, and the traps that make a where date today SQL query return the wrong rows.

Quick Answer

  • Standard SQL, PostgreSQL, MySQL: WHERE date_column = CURRENT_DATE [1].
  • SQL Server: WHERE date_column = CAST(GETDATE() AS DATE), because GETDATE() returns a datetime with a time component [2].
  • SQLite: WHERE date(order_date) = date('now'), since SQLite has no dedicated date type and stores dates as text.
  • If the column holds a timestamp, wrap it in CAST(... AS DATE) or date(...) so the time part does not break the equality.
  • CURRENT_DATE returns the database system date with no time and no time zone offset [1].

Before You Start

You need to know three things before writing the filter.

First, the data type of your date column. A DATE column stores only a day, so equality against today is clean. A TIMESTAMP or DATETIME column stores a day plus a time, so 2026-10-03 14:22:07 is not equal to 2026-10-03. You must strip the time part.

Second, the current date function your database supports. CURRENT_DATE is the ANSI SQL form and works in PostgreSQL, MySQL, and SQL Server 2025 and Azure SQL [1]. Older SQL Server versions do not support it. SQL Server also offers GETDATE(), which returns a datetime value without a time zone offset [2]. SQLite uses date('now').

Third, the time zone your server runs in. CURRENT_DATE derives its value from the operating system on which the database engine runs [1]. If your server is in UTC and your users are in New York, "today" on the server may not be "today" for the user. This matters most near midnight.

A quick way to check what your database thinks today is:

SELECT CURRENT_DATE; -- standard SQL, PostgreSQL, MySQL
SELECT CAST(GETDATE() AS DATE); -- SQL Server
SELECT date('now'); -- SQLite

Run that first. If the value is not the day you expect, fix the time zone before you debug the filter.

Step by Step

  1. Identify the date column and its type. Run a SELECT on a few rows and look at the values. If you see a time component, the column is a timestamp.
  1. Pick the current date expression for your dialect. Use CURRENT_DATE where it is supported [1]. Use CAST(GETDATE() AS DATE) in SQL Server [2]. Use date('now') in SQLite.
  1. Normalize the column if it holds a timestamp. Wrap it as CAST(date_column AS DATE) or date(date_column) so both sides of the comparison are plain dates.
  1. Write the equality filter. The pattern is WHERE <normalized column> = <current date expression>.
  1. Test with a SELECT * before you use the filter in an UPDATE or DELETE. Confirm the row count looks right.
  1. If the query is slow, check whether the function on the column prevents index use. See the Limitations section.

The general shape is:

$$ \text{WHERE } f(\text{date\_column}) = g(\text{current date}) $$

where $f$ strips the time part and $g$ returns today's date.

Worked Example

The table below is an orders table with eight rows. Some orders were placed today, some earlier, and one is dated tomorrow.

order_idcustomer_nameorder_date
1Alice Johnson2026-10-03
2Bob Smith2026-10-03
3Carol White2026-10-02
4David Brown2026-10-01
5Eva Green2026-10-03
6Frank Black2026-10-04
7Grace Lee2026-09-30
8Henry Ford2026-10-03

The goal is to return only the orders placed today. In SQLite the query is:

SELECT * FROM orders WHERE date(order_date) = date('now');

The result was checked with an equivalent SQLite query in sqlite3 3.37.2.

order_idcustomer_nameorder_date
1Alice Johnson2026-10-03
2Bob Smith2026-10-03
5Eva Green2026-10-03
8Henry Ford2026-10-03

Four rows come back. Carol White is excluded because her order is one day old. David Brown and Grace Lee are excluded for the same reason. Frank Black is excluded because his order is dated tomorrow, which is a useful reminder that = matches one day only.

The query works in three parts. date(order_date) extracts the date portion from the stored value so any time component is ignored. date('now') returns the current date in SQLite, which is UTC by default. The = compares the two as plain dates.

If you want to see how date arithmetic works for ranges around today, the DATEADD and DATEDIFF guide covers adding and subtracting days.

Other Ways to Do It

The equality filter is the direct approach. These alternatives cover the same need in different dialects or with different intent.

SQL Server with GETDATE. GETDATE() returns a datetime, so cast it down to a date [2]:

SELECT * FROM orders WHERE CAST(order_date AS DATE) = CAST(GETDATE() AS DATE);

PostgreSQL and MySQL with CURRENT_DATE. CURRENT_DATE already returns a date with no time, so no cast is needed on the right side [1]:

SELECT * FROM orders WHERE order_date = CURRENT_DATE;

A half-open range instead of equality. This form avoids applying a function to the column, which helps index use (PostgreSQL syntax shown, MySQL writes the interval as INTERVAL 1 DAY):

SELECT * FROM orders
WHERE order_date >= CURRENT_DATE
  AND order_date < CURRENT_DATE + INTERVAL '1 day';

The range [today, tomorrow) captures every timestamp during today, including 23:59:59. PostgreSQL documents this half-open interval convention for time periods [3].

Yesterday or tomorrow. Shift the current date with an interval. In PostgreSQL, date '2001-09-28' + interval '1 hour' yields a timestamp, and subtracting two dates gives the number of days between them [3]. The same idea lets you write CURRENT_DATE - INTERVAL '1 day' for yesterday.

A named variable. If you need the same date in several places, compute it once into a variable and reuse it. SQL Server documentation recommends precomputing GETDATE() and passing the value into the query, because the optimizer cannot always estimate cardinality for a live GETDATE() call [2].

For a full treatment of the current date function across dialects, see SQL CURRENT_DATE syntax and examples.

Troubleshooting

The query returns zero rows even though you know there are orders today. The column is probably a timestamp and the time part is breaking equality. Wrap the column in CAST(... AS DATE) or date(...).

The query returns rows from yesterday. Your server time zone is behind your local time zone, or ahead of it. Check the server's current date with the diagnostic query in Before You Start.

The query is slow on a large table. A function wrapped around the column can stop the index from being used. Switch to the half-open range form.

The result changes between runs. CURRENT_DATE and GETDATE() are evaluated at execution time, so a query that runs across midnight can return different rows on each run [1][2].

You get a syntax error on CURRENT_DATE. Some engines want CURRENT_DATE without parentheses and others accept CURRENT_DATE(). Check your dialect. SQL Server 2025 and Azure SQL support CURRENT_DATE as the ANSI equivalent of CAST(GETDATE() AS DATE), but older SQL Server versions raise an error [1].

Common Mistakes

  • Comparing a timestamp column directly to a date. WHERE order_date = CURRENT_DATE fails when order_date holds a time. Fix: cast the column, or use a half-open range.
  • Assuming GETDATE() returns a date. It returns a datetime with a time component [2]. Fix: wrap it as CAST(GETDATE() AS DATE).
  • Ignoring the server time zone. CURRENT_DATE comes from the operating system running the database engine [1]. Fix: confirm the server's date, and convert to the user's zone if the report is user-facing.
  • Using BETWEEN with a date and a timestamp. BETWEEN today AND today matches only the single instant of midnight. Fix: use >= today AND < tomorrow.
  • Forgetting that = matches exactly one day. Rows dated tomorrow are excluded, which is correct but sometimes surprises people who expected "recent" rows. Fix: use a range if you want a window.
  • Hardcoding today's date as a string. The query breaks tomorrow. Fix: use the current date function.

Limitations

The equality filter answers one narrow question: which rows fall on exactly one calendar day. It cannot express "the last seven days" or "this week" on its own. For those you need a range, which means date arithmetic and a decision about which day the week starts on. The DATEPART function guide shows how to extract the parts you need for week and month boundaries.

The bigger limitation is time zones. CURRENT_DATE reflects the database server's clock, not the reader's [1]. A daily sales report built on CURRENT_DATE will disagree with a report built on a user's local midnight, and the gap widens the further the user is from the server. If your data spans regions, store timestamps in UTC and convert at query time, or define an explicit reporting time zone and apply it consistently. Also remember that a function applied to the column can prevent index use, so on large tables the range form is usually the better choice even though the equality form reads more clearly.

Frequently Asked Questions

What is the syntax for where date is today in SQL?

The core pattern is WHERE date_column = CURRENT_DATE in standard SQL, PostgreSQL and MySQL [1]. In SQL Server use WHERE date_column = CAST(GETDATE() AS DATE) [2]. In SQLite use WHERE date(order_date) = date('now'). If the column holds a timestamp, normalize it first.

How do I get today's date in SQL?

Use CURRENT_DATE where your database supports it, since it returns the current database system date as a date value with no time and no time zone offset [1]. SQL Server also accepts GETDATE(), which returns a datetime [2]. SQLite uses date('now').

Why does my query return no rows when the date looks correct?

The most common cause is a time component in the column. A value of 2026-10-03 09:15:00 is not equal to 2026-10-03. Cast the column to a date, or switch to a half-open range from today to tomorrow.

Can I use WHERE date = NOW() in SQL?

NOW() exists in MySQL and PostgreSQL and returns a timestamp, so comparing a date column to it directly usually fails. Use CURRENT_DATE instead, or cast NOW() down to a date. In SQL Server the equivalent function is GETDATE() [2].

How do I filter for today without hurting performance?

Avoid wrapping the column in a function. Write the filter as a range instead: WHERE order_date >= CURRENT_DATE AND order_date < CURRENT_DATE + INTERVAL '1 day'. This keeps the column bare so an index on it can still be used. PostgreSQL documents this half-open interval pattern for time periods [3].

References

  1. CURRENT_DATE (Transact-SQL) - SQL Server | Microsoft Learn
  2. GETDATE (Transact-SQL) - SQL Server | Microsoft Learn
  3. PostgreSQL: Documentation: 18: 9.9. Date/Time Functions and Operators

Further Reading

Related Articles