Month days !!!

Tools
Enthusiast

Month days !!!

Hi,

Could any one explain this code logic,

DAY(DATEADD(ms,-2,DATEADD(MONTH, DATEDIFF(MONTH,0,CURRENT_DATE.DAY)+1,0)))

and provide me alternate code in tera data...

Thanks..

1 REPLY
Junior Contributor

Re: Month days !!!

What DBMS is this?

Looks like MS SQL Server, but this CURRENT_DATE.DAY is strange.

Would be easier if you add the current result, but this seems to return the last day of the current month:

EXTRACT(DAY FROM LAST_DAY(CURRENT_DATE))