I am getting unexpected result when using combination of LAST_DAY and TRUNC:
select LAST_DAY(TRUNC(sysdate, 'DAY')) from dual;
--31-JUL-2021 00:00:00
select TRUNC(LAST_DAY(sysdate), 'DAY')from dual;
--26-JUL-2021 00:00:00
Why these calls does not return same results? I mean, what is the difference between:
- I want today to be truncated (get rid of hours)
- Then get last day of the month
And
- I want last day of the month (with hour)
- And then get rid of the hour part