from datetime import datetime


def weekday(date):
    """ Generate day of the week based on date (as string or as datetime object)"""

    if isinstance(date, str):

        date = datetime.strptime(date, "%m-%d-%Y")  # change the format if necessary # "%Y-%m-%d"

    return date.strftime("%A")