from dateutil import tz
from datetime import datetime


def timestamp_to_local(timestamp):
    """
    Converts unix timestamp in milliseconds to local time.
    :param timestamp:
    :return: string type formatted as YYYY-mm-dd
    """
    timestamp = timestamp/1000
    local_tz = tz.tzlocal()

    dt_utc = datetime.utcfromtimestamp(timestamp)
    dt_local = dt_utc.replace(tzinfo=local_tz)
    date_str = dt_local.strftime("%Y-%m-%d")
    return date_str