How to generate a particular date in a year

Database

How to generate a particular date in a year

I was working on a SQL script and there will be 2 date fields let's say start date and end date. The start date should be may 31st of this year and end date should be April 30th of next year. How to do this?

2 REPLIES
Junior Contributor

Re: How to generate a particular date in a year

cast(extract(year from current_date) || '-05-31' as date)
cast(extract(year from add_months(current_date,12)) || '-04-30' as date)

Re: How to generate a particular date in a year

Thank You. you are the best.