You can translate the question and the replies:

First of previous month

how do i get first of previous month? addmonth(current_date(),-1) provides exactly one month ago , but how do i set to always get 1st. for example, from 4/1-4/30, want to pull from 3/1.
19-04-2023 14:19:30 -0400

1 Answer

Greetings, Hope you are doing well. Checkout the [FIRSTDAYOFMONTH]( function supported by Virtual DataPort. This function returns the first day of a month based on the datetime value passed as an argument. And in this case, it would be the ADDMONTH function you have utilized. Example: ``` SELECT current_date as today , FIRSTDAYOFMONTH(addmonth(current_date(),-1)); ``` For more datetime functions , please refer to the following [guide]( Hope this helps !
Denodo Team
20-04-2023 07:50:33 -0400
You must sign in to add an answer. If you do not have an account, you can register here