All Forums General
jillalakk 3 posts Joined 01/15
12 Sep 2015
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.

dins2k2 51 posts Joined 05/13
30 Nov 2015

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.


You must sign in to leave a comment.