As in this situation, it would be more correct to store the date. There is a table of holidays that holds holidays for several countries. I need to store the date of the beginning and end of the holiday in order to calculate the duration of the holiday. The question is if I add a holiday at the moment in 2016 year, how in 2017 the system will understand that this day has come? Update the year for all holidays for the current or just store the month and day of each holiday without a year.

  • There is one more thing. Holidays next year for various reasons may be somewhat different ... Ie at least we also need an interval of action - Mike
  • Did not quite understand what interval it was! - quaresma89
  • Well, it seems we take the day of the Great October Revolution. From 1918 to 1991, it was celebrated on November 7 and 8. in 1992, November 8 was a working day. 1995 he (7th) was the day of military glory, 1996 - the day of consent and reconciliation. Since 2005, November 7 has ceased to be a holiday. Thus, if we want to keep one record, then for November 8, we need to specify the interval of action from 1918 to 1991. I would keep dates for some base year, so it's easier to calculate the difference. But it seems to me there may be another rake in February with leap years. And there may be holidays, on days of the week, such as “the second Monday of March” - Mike
  • And the holiday itself is the best way to store? Line format MM-DD and then stick the current year? - quaresma89
  • one
    Why not. What would you want the employee to check is ideally not to take the entire calendar but to stupidly look for a date employee between or in general = a date calendar. When join tables, the year-day assembly or date correction will be expensive. although you can only take the date without the year from the employee and hard to look for it in the calendar. And by the way, why do you need all countries? - Mike

1 answer 1

The problem is extensive.

  • Repeatability: Religious holidays are pegged to the day of the week, and possibly to the lunar calendar.
  • Reglability The government approves and cancels holidays. In the comments you indicated this.

I'm afraid without manual adjustment every year can not do. I would make it possible to copy data for the year for subsequent moderation.

UPDATED :
Perhaps for your task you will be enough to know the "production calendar", which is approved by the authorities for next year. You can store it simply as a list of non-working days, one entry per day. In your case, with the attribute of the country.

Useful links on the topic: