def create_quarterly_schedule_details(api, api_exception, day):
    """ Creates a ScheduleDetails object for use with a scheduled task for quarterly execution (every 3 months).

    :param api: The Deep Security API modules.
    :param api_exception: The Deep Security API exception module.
    :param day: The day of the month on which the scheduled task runs.
    :return: A ScheduleDetails object.
    """

    # Create a ScheduleDetails object and set the recurrence type
    quarterly_schedule = api.ScheduleDetails()
    quarterly_schedule.recurrence_type = "monthly"

    # Specify when the task runs
    monthly_schedule_parameters = api.MonthlyScheduleParameters()

    # Set the schedule to run on a specific day of the month.
    # Other options are the last day of the month, or a specific weekday of a specific week
    monthly_schedule_parameters.frequency_type = "day-of-month"

    # Set the day
    monthly_schedule_parameters.day_of_month = day

    # Set the months to be quarterly
    monthly_schedule_parameters.months = ["january", "april", "july", "october"]

    # Add the schedule parameters to the schedule details
    quarterly_schedule.monthly_schedule_parameters = monthly_schedule_parameters

    return quarterly_schedule