from datetime import datetime


def structured_data_datetime(dt):
    """
    Formats datetime object to structured data compatible datetime string.
    """
    if dt.time():
        return datetime.strftime(dt, "%Y-%m-%dT%H:%M")
    return datetime.strftime(dt, "%Y-%m-%d")