Snowflake CURRENT DATE: How to Get the Current Date
The CURRENT_DATE
function is a SQL command that returns the current date of the system. It’s especially useful for date-sensitive data operations, such as logging events or filtering data dynamically up or for the present day.
What it does
CURRENT_DATE
provides the date today, based on the server’s system clock and time zone configuration.
Syntax
The function can be used in two ways:
_10CURRENT_DATE()_10_10-- or, to adhere to ANSI standards you can call the function without parentheses_10CURRENT_DATE
Both forms will return the current date.
Key points
- Time Zone Dependent: The result of
CURRENT_DATE
is influenced by the session’s time zone setting, ensuring that the date is accurate to the locale of the server or the specified session time zone. - Output Format: The appearance of the date in query results is governed by the
DATE_OUTPUT_FORMAT
session parameter, which defaults to YYYY-MM-DD.
Examples
Get the current date, alongside time and timestamp functions
To see how CURRENT_DATE
works within a query, alongside time and timestamp functions, you might use:
Snowflake SQL Query
_10SELECT CURRENT_DATE(), CURRENT_TIME(), CURRENT_TIMESTAMP();
Output
current_date() | current_time() | current_timestamp |
---|---|---|
2024-05-22 | 10:29:53 | 2024-05-22 10:29:53.559 +0200 |
![Y42 SQL completion user interface](/learn/_next/image?url=%2Flearn%2Fimages%2Fcta%2Fsql-completion.webp&w=3840&q=100)