Switch Datacenter/Switchover Dates

From Wikitech

Dates

In the year 2023, Switchovers happen on:

Northward Switchover: 2023-03-22 14:00:00 UTC

Southward Switchover: 2023-09-20 14:00:00 UTC

In the year 2024, Switchovers happen on:

Northward Switchover: 2024-03-20 14:00:00 UTC

Southward Switchover: 2024-09-25 14:00:00 UTC

In the year 2025, Switchovers happen on:

Northward Switchover: 2025-03-19 14:00:00 UTC

Southward Switchover: 2025-09-24 14:00:00 UTC

In the year 2026, Switchovers happen on:

Northward Switchover: 2026-03-25 14:00:00 UTC

Southward Switchover: 2026-09-23 14:00:00 UTC

In the year 2027, Switchovers happen on:

Northward Switchover: 2027-03-24 14:00:00 UTC

Southward Switchover: 2027-09-22 14:00:00 UTC

In the year 2028, Switchovers happen on:

Northward Switchover: 2028-03-22 14:00:00 UTC

Southward Switchover: 2028-09-20 14:00:00 UTC

In the year 2029, Switchovers happen on:

Northward Switchover: 2029-03-21 14:00:00 UTC

Southward Switchover: 2029-09-19 14:00:00 UTC

In the year 2030, Switchovers happen on:

Northward Switchover: 2030-03-20 14:00:00 UTC

Southward Switchover: 2030-09-25 14:00:00 UTC

In the year 2031, Switchovers happen on:

Northward Switchover: 2031-03-19 14:00:00 UTC

Southward Switchover: 2031-09-24 14:00:00 UTC

In the year 2032, Switchovers happen on:

Northward Switchover: 2032-03-24 14:00:00 UTC

Southward Switchover: 2032-09-22 14:00:00 UTC

In the year 2033, Switchovers happen on:

Northward Switchover: 2033-03-23 14:00:00 UTC

Southward Switchover: 2033-09-21 14:00:00 UTC

In the year 2034, Switchovers happen on:

Northward Switchover: 2034-03-22 14:00:00 UTC

Southward Switchover: 2034-09-20 14:00:00 UTC

In the year 2035, Switchovers happen on:

Northward Switchover: 2035-03-21 14:00:00 UTC

Southward Switchover: 2035-09-19 14:00:00 UTC

In the year 2036, Switchovers happen on:

Northward Switchover: 2036-03-19 14:00:00 UTC

Southward Switchover: 2036-09-24 14:00:00 UTC

In the year 2037, Switchovers happen on:

Northward Switchover: 2037-03-25 14:00:00 UTC

Southward Switchover: 2037-09-23 14:00:00 UTC

In the year 2038, Switchovers happen on:

Northward Switchover: 2038-03-24 14:00:00 UTC

Southward Switchover: 2038-09-22 14:00:00 UTC

In the year 2039, Switchovers happen on:

Northward Switchover: 2039-03-23 14:00:00 UTC

Southward Switchover: 2039-09-21 14:00:00 UTC

In the year 2040, Switchovers happen on:

Northward Switchover: 2040-03-21 14:00:00 UTC

Southward Switchover: 2040-09-19 14:00:00 UTC

In the year 2041, Switchovers happen on:

Northward Switchover: 2041-03-20 14:00:00 UTC

Southward Switchover: 2041-09-25 14:00:00 UTC

In the year 2042, Switchovers happen on:

Northward Switchover: 2042-03-19 14:00:00 UTC

Southward Switchover: 2042-09-24 14:00:00 UTC

In the year 2043, Switchovers happen on:

Northward Switchover: 2043-03-25 14:00:00 UTC

Southward Switchover: 2043-09-23 14:00:00 UTC

In the year 2044, Switchovers happen on:

Northward Switchover: 2044-03-23 14:00:00 UTC

Southward Switchover: 2044-09-21 14:00:00 UTC

In the year 2045, Switchovers happen on:

Northward Switchover: 2045-03-22 14:00:00 UTC

Southward Switchover: 2045-09-20 14:00:00 UTC

In the year 2046, Switchovers happen on:

Northward Switchover: 2046-03-21 14:00:00 UTC

Southward Switchover: 2046-09-19 14:00:00 UTC

In the year 2047, Switchovers happen on:

Northward Switchover: 2047-03-20 14:00:00 UTC

Southward Switchover: 2047-09-25 14:00:00 UTC

In the year 2048, Switchovers happen on:

Northward Switchover: 2048-03-25 14:00:00 UTC

Southward Switchover: 2048-09-23 14:00:00 UTC

In the year 2049, Switchovers happen on:

Northward Switchover: 2049-03-24 14:00:00 UTC

Southward Switchover: 2049-09-22 14:00:00 UTC

Code

The list above was calculated with the following Python code

#!/usr/bin/python3
'''
A PoC python module to print out switchover dates up to 2050
'''

from datetime import datetime

EQUINOX_DAY = 21

def calculate_switchover_date(year: int) -> None:
    '''
    Gives the exact date of the switchovers
    '''

    northward = datetime(year, 3, EQUINOX_DAY)
    switchover = calculate_wednesday(northward)
    print(f'\tNorthward Switchover: {switchover} UTC')
    southward = datetime(year, 9, EQUINOX_DAY)
    switchover = calculate_wednesday(southward)
    print(f'\tSouthward Switchover: {switchover} UTC')

def calculate_wednesday(date: datetime) -> datetime:
    '''
    Find the Wednesday the Switchover is to happen on. The algorith, as sketched
    out on the proposal is as follows:

    If the 21st is a Saturday => Switchover on the 25th
    If the 21st is a Sunday => Switchover on the 24th
    If the 21st is a Monday => Switchover on the 23rd
    If the 21st is a Tuesday => Switchover on the 22rd
    If the 21st is a Wednesday => Switchover on the 21st
    If the 21st is a Thursday => Switchover on the 20th
    If the 21st is a Friday => Switchover on the 19th
    '''

    weekday = date.weekday()
    month = date.month
    year = date.year
    # Monday to Friday, weekday=0 to 4
    if 0 <= weekday <= 4:
        switchover = datetime(year, month , 23 - weekday, 14, 0, 0)
    # Saturday and Sunday, weekday=5 and 6 respectively
    else:
        switchover = datetime(year, month, 30 - weekday, 14, 0, 0)
    return switchover

for y in range(2023, 2050):
    print(f'In the year {y}, Switchovers happen on:')
    calculate_switchover_date(y)