from datetime import datetime


def timestamp_ms_to_doy(timestamp_ms):
    """Convert a timestamp in milliseconds to day-of-year"""
    d = datetime.fromtimestamp(timestamp_ms / 1000.).date()
    return int(d.strftime('%j'))