def correct_date(date):
    """
    Converts the date format to one accepted by SWA

    SWA form cannot accept slashes for dates and is in the format YYYY-MM-DD
    :param date: Date string to correct
    :return: Corrected date string

    """

    if date is None:
        return ""
    else:
        a, b, c = date.split("/")
        if len(a) == 4:
            # Assumed format is year, month, day
            return "%s-%s-%s"%(a, b, c)
        else:
            # Assumed format is month, day, year
            return "%s-%s-%s" % (c, a, b)