There is a time value in seconds for example 1471282495000 how to translate it into readable PST format?
2 answers
To get information about the time zone, you can use the pytz
module (pure Python) :
>>> from datetime import datetime >>> import pytz # pip install pytz >>> millis = 1471282495000 >>> str(datetime.fromtimestamp(millis*1e-3, pytz.timezone('America/Los_Angeles'))) '2016-08-15 10:34:55-07:00'
- Thank you very much, it helped, it works as it should)) - Vindict
|
import datetime date = datetime.datetime.fromtimestamp(1471282495000 / 1000) print(date)
- this returns local time as a naive
datetime
object 1-local time zone may differ from Pacific Standard Time 2- time zone information is lost - jfs
|