Knowledge base / SQL

CURRENT_DATE in SQL: today's date, zones and filter boundaries

I check the column type before comparing it with today's date. Here are explicit day boundaries and the differences between database engines.

Kajo RudzińskiPublished Updated 4 min read

A calendar frames one day's event cubes between boundaries in yellow and navy pixel art.

CURRENT_DATE helps identify the current day, but I first check the engine, column type and time zone. The name does not guarantee identical behaviour in every database. Confusing a calendar date with an event timestamp can make an equality filter lose orders placed after midnight. The examples below keep those assumptions explicit and use small synthetic cases.

What CURRENT_DATE returns

PostgreSQL 18 and MySQL 8.4 return a date. Its displayed format depends on the client; a date value is not inherently a string in one fixed presentation. Oracle 19c returns its DATE type, which also contains a time component. SQL Server introduced CURRENT_DATE in version 2025; earlier versions need another expression.

Environment Getting the current date Relevant boundary
PostgreSQL 18 SELECT CURRENT_DATE; Current transaction’s start and session time zone
MySQL 8.4 SELECT CURRENT_DATE; Session time zone; parentheses are also supported
SQL Server 2025 SELECT CURRENT_DATE; Unavailable in SQL Server 2022
SQL Server 2022 SELECT CAST(GETDATE() AS date); Date derived from the clock used by GETDATE
Oracle 19c SELECT CURRENT_DATE FROM DUAL; Session time zone, DATE includes time
SQLite SELECT CURRENT_DATE; UTC date text

See PostgreSQL, MySQL, SQL Server CURRENT_DATE, GETDATE, Oracle and SQLite. PostgreSQL’s transaction-start rule should not be assumed for every other engine.

Compare a column containing dates only

In PostgreSQL 18, equality is appropriate when order_date has type date and represents an order’s calendar day in the agreed business calendar:

SELECT id, order_date
FROM orders
WHERE order_date = CURRENT_DATE;

Suppose the current date is 15 November 2026. Records dated 15 November pass; those dated 14 or 16 November do not. A NULL date does not satisfy the comparison either. This reasoning depends on the field containing a day only. We have not silently assumed that the same column also stores the time the order was placed.

Use a range for timestamps

Now assume PostgreSQL 18 and ordered_at of type timestamp without time zone, stored as business-local time consistent with the session zone. Select today’s records from the start of today inclusively to the start of tomorrow exclusively:

SELECT id, ordered_at
FROM orders
WHERE ordered_at >= CURRENT_DATE
  AND ordered_at < CURRENT_DATE + 1;

For our synthetic day, records at 00:00 and 15:30 pass. Midnight on 16 November does not. Equality with CURRENT_DATE would select only exact midnight. PostgreSQL documents that comparing a date with a timestamp assumes midnight for the date. This explains how valid syntax can return surprisingly few records.

I avoid defining the end as 23:59:59 because timestamps can contain fractional seconds. An exclusive upper boundary also lets adjacent reporting days share a boundary without counting midnight twice. If the column stores UTC moments or uses timestamptz, derive boundaries in the agreed business zone. Do not transplant the local-timestamp example without establishing that rule first.

Two day boundaries contain selected events while neighbouring events remain outside the interval.

Date arithmetic has its own dialect

In PostgreSQL 18, adding seven calendar days to a date can be written simply:

SELECT CURRENT_DATE + 7 AS next_week;

MySQL 8.4 supports this form:

SELECT DATE_ADD(CURRENT_DATE, INTERVAL 7 DAY) AS next_week;

For SQL Server 2022, use an expression that does not require CURRENT_DATE:

SELECT DATEADD(day, 7, CAST(GETDATE() AS date)) AS next_week;

With 15 November as the starting date, the result refers to 22 November. This is a calendar-day shift, without a promise of seven working days. Holidays, local closures and working calendars need separate definitions. Naming the output next_week does not establish those business rules.

Oracle dates include a time

Oracle CURRENT_DATE is not a date stripped of its time component. TRUNC for dates can produce the beginning of its day. For an Oracle DATE column storing local time consistent with the session, today’s boundaries can be expressed as follows:

SELECT id, ordered_at
FROM orders
WHERE ordered_at >= TRUNC(CURRENT_DATE)
  AND ordered_at < TRUNC(CURRENT_DATE) + 1;

Establish the time zone and source meaning first here as well. Changing the displayed format does not remove time from the stored value. A client showing only a day and month can hide the difference between two moments. That is one reason apparently identical dates can fail an equality comparison.

Decide whether the report must be reproducible

A current-date expression changes the result with the calendar. For a report that must be reproduced next month, I would prefer an explicit reporting-date parameter. It records the intended period. In PostgreSQL, also remember that a long transaction can cross midnight while CURRENT_DATE still reflects its start rather than the advancing wall clock.

Practise with three records: today’s start, today’s afternoon and tomorrow’s start. Add one missing date. Explain which pass equality for a date column and which pass the timestamp range. Then read CURRENT_TIME and WHERE filtering to keep a time of day distinct from a complete event timestamp.

Key takeaways

Does CURRENT_DATE work in SQL Server 2022?

No. It is available from SQL Server 2025. In version 2022, CAST(GETDATE() AS date) can produce the date.

Why does equality with CURRENT_DATE miss orders?

A column containing time may match only exact midnight. For the whole day, use an inclusive lower boundary and an exclusive start-of-next-day boundary.

Does Oracle CURRENT_DATE remove the time?

No. It returns an Oracle DATE with a time component in the session zone. TRUNC(CURRENT_DATE) can produce the start of its day.

AI was used in an automated way while working on this article. If you want to learn how to do it too, check out this project.

Kajo Rudziński

Newsletter KajoData

Let’s keep in touch.

I write about data analysis, learning and changing careers. My newsletter and the sign-up form are in Polish. If that works for you, I’d be glad to see you there.