George Kosmidis

Microsoft MVP | Cloud Solutions Architect | .NET Software Engineer | Organizer of Munich .NET Meetup | Speaker

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

by George Kosmidis / Published 9 years and 5 months ago, modified 2 years and 4 months 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

My next events!

Online event
Online event
Online
Mindspace Salvatorplatz (Salvatorplatz 3, München, BY, Germany 80333)
Online