Headder AdSence

how to get first day of month in snowflake

 we have a function in the snowflake, that will truncate the month/year from the given date.


here are few examples.

1. Using Current_Date function

SELECT CURRENT_DATE() AS Today_Date,DATE_TRUNC(MONTH,CURRENT_DATE()) AS Start_Date;

Output: 



2. By using Hardcoded Value

SELECT '2021-05-26' AS Actual_Date,DATE_TRUNC(MONTH,TO_DATE('2021-05-26')) AS Start_Date;


OutPut: 




1 comment:

  1. Hi, This is so informative blog, I am doing course on SQL BI Course and this blog is really informative for me. Thank you for this blog!

    ReplyDelete