MySQL Forums
Forum List  »  Quality Assurance

Date Function to obtain holiday date
Posted by: Andres Rovira
Date: July 16, 2008 02:02PM

Hi, I have a mysql database and a holidays table inside. As you know, there are standard fixed holidays (like christmas, happening every december 25th), and there are variable holidays (like the ones that happen the first saturday of the month, the last sunday of the month, and like that). I am storing this two type of holidays and then I have to display them. For the fixed there is no problem, as I only display the day, the month and the current year. For the variables, I use the weekday number (1=sunday,2=monday, etc), the th value (the 1st monday..., the 3rd friday..., etc.), the month, and the current year.

WHERE (fixeddate = 1 AND DATE(CONCAT(YEAR(CURRENT_DATE),'-',fix_month,'-',fix_day)) BETWEEN CURRENT_DATE AND DATEADD(CURRENT_DATE, INTERVAL 30 DAY)) OR
(fixeddate = 0 AND DATE(/* here I need to obtain the date for the variables on the current year*/) BETWEEN CURRENT_DATE AND DATEADD(CURRENT_DATE, INTERVAL 30 DAY))

How can I obtain the variable date for the current year?

Options: ReplyQuote


Subject
Views
Written By
Posted
Date Function to obtain holiday date
8357
July 16, 2008 02:02PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.