calculate quarterend dates from datetime value

General

calculate quarterend dates from datetime value

I have a date column , from which it has to calculate quarter end date for each date value. The values are stored in datetime format.

Data_Have                   Data_want

01Jan2015                  31Mar2015

23Jan2015                  31Mar2015

11May2015                 30Jun2015

15Jun2015                  30Jun2015

Thanks in Advance.

Thanks,

KJ

1 REPLY
Enthusiast

Re: calculate quarterend dates from datetime value

Hi KJ,

This should work. Most of the calendar related coulmns can be fetched from Sys_Calendar.BusinessCalendar table. This is tested in TD 14.10.

Below is the query.

Sel QuarterEnd as "Date_Want" from Sys_Calendar.BusinessCalendar where calendar_date=TO_CHAR(TO_DATE ('01Jan2015' , 'DDMonYYYY'), 'YYYY-MM-DD')

Output of the date can be casted to your required format.

Thanks,

Dinesh