from datetime import datetime


def to_time_format(timestamp: int, fmt: str = '%Y-%m-%d %H:%M:%S'):
    """
    Convert timestamp to string using format.

    :param timestamp: Timestamp in ms
    :param fmt: Format.
    :return:
    """
    return datetime.fromtimestamp(int(timestamp) // 1000).strftime(fmt)