def to_month_only_dob(date):
    """
    Convert dates of birth into month and year of birth starting from 1st of each month for anonymity
    return blank if not in the right format
    """
    try:
        date = date.strftime("%Y-%m-01")
    except ValueError:
        date = ""
    except TypeError:
        date = ""
    except AttributeError:
        date = ""
    return date