George Kosmidis

Microsoft MVP | Speaks of Azure, AI & .NET | Founder of Munich .NET
Building tomorrow @
slalom
slalom

C#: Calculating all Greek Public Holidays for any given year

by George Kosmidis / Published 11 years ago, modified 4 years ago

After calculating the Greek Orthodox Easter, it was time for the public holidays calculation. With the Easter calculation ready, it proved to be much easier than expected!

/// 
/// Get all Greek holidays for requested year
/// 
/// Year of holidays
/// List of dates of all public holidays, except weekends
public static List GreekHolidays(int year)
{
    var easter = GetOrthodoxEaster(year);
    var holidays = new List();
    
    holidays.Add(new DateTime(year, 1, 1));     //prwtoxronia
    holidays.Add(new DateTime(year, 1, 6));     //fwta
    holidays.Add(easter.AddDays(-48));          //kathara deytera
    holidays.Add(new DateTime(year, 3, 25));    //25i martioy
    holidays.Add(new DateTime(year, 5, 1));     //prwtomagia
    holidays.Add(easter.AddDays(-2));           //megali paraskevi
    holidays.Add(easter.AddDays(-1));           //megali savvato
    holidays.Add(easter);                       //pasxa
    holidays.Add(easter.AddDays(1));            //deyterh mera
    holidays.Add(easter.AddDays(50));           //agiou pnevmatos
    holidays.Add(new DateTime(year, 8, 15));    //koimisi theotokou
    holidays.Add(new DateTime(year, 10, 28));   //28i oktovriou
    holidays.Add(new DateTime(year, 12, 25));   //xristougenna
    holidays.Add(new DateTime(year, 12, 26));   //deyterh mera

    return holidays;
}

You can find the code that calculates Greek Orthodox Easter here: /c-calculating-orthodox-and-catholic-easter/

This page is open source. Noticed a typo? Or something unclear?
Edit Page Create Issue Discuss
Microsoft MVP - George Kosmidis
Azure Architecture Icons - SVGs, PNGs and draw.io libraries