The function below will calculate the date of Easter Sunday.
Function Get-DateOfEaster { param ( [int]$Year, [int]$GregorianStart = 1752 ) # Reads a Year and returns the date of Easter Sunday. # For Easter dates prior to 1926 the start of the Gregorian calendar needs to be considered. # Different countries adopted the Gregorian calendar on different dates. # France, Spain, Portugal = 1582 # Netherlands = 1583 # Switzerland = 1584 # UK + colonies = 1752 # Turkey = 1926 # Setting $GregorianStart > $Year, will return Easter on the Julian calendar. [int]$GoldenNo = $Year % 19 #modulus If ($Year -gt $GregorianStart) { [int]$Century = [math]::floor($Year / 100) [int]$intK = [math]::floor(($Century - 17) / 25) [int]$intI = $Century - [math]::floor(($Century / 4)) [int]$intI = $intI - [math]::floor((($Century - $intK) / 3)) + 19 * $GoldenNo + 15 [int]$intI = $intI % 30 [int]$intN1 = $intI - [math]::floor(($intI / 28)) [int]$intN21 = [math]::floor(($intI / 28)) [int]$intN22 = [math]::floor((29 / ($intI + 1))) [int]$intN23 = [math]::floor(((21 - $GoldenNo) / 11)) [int]$intI = $intN1 * (1 - $intN21 * $intN22 * $intN23) [int]$intJ = $Year + [math]::floor(($Year / 4)) + $intI [int]$intJ = $intJ + 2 - $Century + [math]::floor(($Century / 4)) [int]$intJ = $intJ % 7 $Cal = 'Gregorian' } Else { [int]$intI = ((19 * $GoldenNo) + 15) % 30 [int]$intJ = ($Year + [math]::floor(($Year / 4)) + $intI) % 7 $Cal = 'Julian' } [int]$intL = $intI - $intJ [int]$Month = 3 + [math]::floor((($intL + 40) / 44)) [int]$Day = $intL + 28 - 31 * [math]::floor(($Month / 4)) "$Year-0$Month-$Day ($Cal)" $DateTime = New-Object DateTime $Year, $Month, ($Day), 0, 0, 0, ([DateTimeKind]::Utc) Return $DateTime } " Examples:" $Easter = Get-DateOfEaster 2025 "$Easter" $Easter = Get-DateOfEaster 1590 1752 "$Easter"
“If you are lucky enough to have lived in Paris as a young man, then wherever you go for the rest of your life, it stays with you, for Paris is a moveable feast” ~ Ernest Hemingway
Get-BankHolidaysUK - Retrieve UK Bank Holidays from a web service.
Adoption of the Gregorian calendar - Wikipedia.