No matter the time of year, it seems that a holiday looms on the horizon. It could be a religious holiday, a national day, or some other festive event. Many people may get the day off from work to celebrate. For programmers, the holiday is also a celebration but not from work: coders still code, but it’s a more enjoyable experience because everyone else is on vacation, which means fewer interruptions.
Your computer doesn’t care whether one day is a holiday. It’s not being ignorant; it just doesn’t know. To help the computer understand which day is a holiday, and to help you complete other programming projects that rely upon knowing which days are holidays, you must:
- Understand how the operating system uses return values
- Work with date programming in C
- Review major holidays
- Calculate regular holidays
- Deal with irregular holidays
- Figure out when Easter occurs
- Put your holiday function to the test
These tasks help build routines that detect and report on holidays given a specific day of the year. Such a utility isn’t specifically useful by itself, but it does come into play when programming dates or performing other tasks where knowing when a holiday occurs is important. For example, I wrote a stock tracker where it was useful to know which days not to fetch the stock data because the markets are closed. And my trash pickup reminder shell script uses my holiday program to see whether trash day has shifted.