'Custom Function defining in python?

I am trying to make a function in which user can pass two parameters, One is date and other is time interval according to utc. There are some conditions to implement this function as I am defining it for according to forex market. Market completely Opens at Monday, Tuesday, Wednesday, Thursay (24) hours. On the other hand market closed on Friday at 9pm , On saturday it completely closed and on Sunday it open from 10pm. It should be according to utc. What my function should do, It takes the date and timeinterval, let'say I pass '2022-02-09 22:00:00' and 5, It means it add the number of hours in the current time and give new updated time. It should satisifes all conditions. I am trying my code but I am confusing.

My code:

from datetime import datetime, timedelta
import calendar

def findDay(date):
    my_date = datetime.utcnow()
    return calendar.day_name[my_date.weekday()]

def custom_date_function(date, time_interval):
    
    day = findDay(date)
    if day == 'Saturday':
        pass
    else:
        if day == 'Friday':
            break
 
date = '2022-02-09 22:00:00'
time_interval = 1
custom_date_function(date, time_interval)


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source