today() and currentDate() return the server’s current date as a Date value in ClickHouse.
today() returns the server’s current date as a Date type, identical to the value of currentDate(). It is the ClickHouse equivalent of PostgreSQL’s CURRENT_DATE, but follows the server time zone rather than the client’s.
Run a simple SELECT statement. Both functions are argument-free and available in every ClickHouse build.
SELECT today() AS current_date;
SELECT currentDate() AS current_date;
Yes. Cast your DateTime column to Date, then compare it to today() to avoid mismatched types.
SELECT *
FROM Orders
WHERE toDate(order_date) = today();
today() → Date • currentDate() → Date • toDate(now()) → Date
Prefer today() for date-only comparisons. Use now() when you need a full timestamp. Store data in UTC and remember that today() respects the server time zone, not the client’s.
The comparison fails because DateTime ≠ Date. Fix by casting: toDate(created_at) = today().
today() follows the server’s zone. Set the session time zone or convert values to UTC to avoid surprises.
No. Use today() or currentDate(). CURRENT_DATE is parsed as an identifier and triggers a syntax error.
Call yesterday(), or use subtractDays(today(), 1).
Yes—define the column as created_on Date DEFAULT today().
No. Use today() or currentDate().
Use yesterday(), tomorrow(), or subtractDays()/addDays() around today().
Yes, but remember it evaluates at INSERT time, not SELECT time.