Hello experts,
i have a situation where i need to get the YTD and MTD out of sysdate.
the query i am using is below:
select TRUNC(sysdate, ‘year’)-1 from dual as YTD /* this is not giving desired result, giving 12/31/2021 which is not correct it must be 1/1/2021 */
select TRUNC(sysdate, ‘mon’)-1 from dual as MTD /* gave 12/31/2021 when ran on jan 13 2022 */
Please help me in getting correct ytd and mtd dates