from typing import Union
from datetime import datetime


def timestamp_milliseconds_to_datetime(ts: Union[int, float]) -> datetime:
    """
    Convert posix milliseconds timestamp to datetime object.

    Parameters
    ----------
    ts : Union[int, float]
        The timestamp in milliseconds to convert

    Returns
    -------
    datetime
        The corresponding datetime object

    """
    return datetime.fromtimestamp(ts / 1000).astimezone()