how to create datetime from a negative epoch in Python

后端 未结 3 1021
既然无缘
既然无缘 2021-01-18 02:40

First timer on StackExchange.

I am working with ArcGIS Server and Python. While trying to execute a query using the REST endpoint to a map service, I am getting the

3条回答
  •  遥遥无期
    2021-01-18 03:12

    if timestamp < 0:
        return datetime(1970, 1, 1) + timedelta(seconds=timestamp)
    else:
        return datetime.utcfromtimestamp(timestamp)
    

提交回复
热议问题