Explained: CURRENT_DATE() function in Snowflake?

Are you looking to find how to use the CURRENT_DATE() function within the Snowflake cloud data warehouse or maybe you are looking for a solution, how to use the CURRENT_DATE function in the Snowflake? If you are looking for any of these problem solutions then you have landed on the correct page. I will also show you what and how to use the CURRENT_DATE() function. I will explain the CURRENT_DATE() function by taking a practical example. So don’t waste time let’s start a step-by-step guide to understanding what is the CURRENT_DATE() expression.

What is the CURRENT_DATE() Function?

CURRENT_DATE helps to get the current system date. For example, if we want to insert data that includes current date at that point of time, then we can make use of CURRENT_DATE.

How can we use CURRENT_DATE() Function ?

The CURRENT_DATE() function is used to return the current date of the system. To comply with ANSI standards, this function can be called without parentheses.

What is the syntax of the CURRENT_DATE?

-- Syntax : 

CURRENT_DATE()
CURRENT_DATE

Example of CURRENT_DATE function in Snowflake:

select current_date();

+----------------+
| CURRENT_DATE() |
|----------------|
| 2022-01-12     |
+----------------+

What is the Difference between CURRENT_DATE, CURRENT_TIME AND CURRENT_TIMESTAMP?

CURRENT_DATECURRENT_TIMECURRENT_TIMESTAMP
It return only the current date.It will only return the current timeIt will return current date along with time.
Current Date Time Difference Table
select current_date(), current_time(), current_timestamp();

+----------------+----------------+-------------------------------+
| CURRENT_DATE() | CURRENT_TIME() | CURRENT_TIMESTAMP()           |
|----------------+----------------+-------------------------------|
| 2022-01-12     | 19:15:08       | 2022-01-12 19:15:08.593 -0800 |
+----------------+----------------+-------------------------------+

When you should use CURRENT_DATE() Function in Snowflake?

There are certain use case scenarios when it is recommended to use the CURRENT_DATE function within the Snowflake cloud data warehouse which are as follows:

  • You want to match the current date with column value to get the required output.
  • You want to insert the data along with the current date.

Real World Use Case Scenarios for CURRENT_DATE Function in Snowflake

  • You wanted to fetch the data of all the customers who filled the application form on current date.
  • In Hotel Management application, If you want to know the total orders

CURRENT_DATE Snowflake Official Documentation Link

Final Thoughts

In this article, we have learned about CURRENT_DATE() function and uses with the examples explained clearly. I have also covered different scenarios with a practical example that could be possible. I hope the information that was provided is helped in gaining the knowledge.

Please share your comments and suggestions in the comment section below and I will try to answer all your queries as time permits.

Leave a Comment