import time #將10位時間戳或者13位轉換為時間字符串,默認為2017-10-01 13:37:04格式 def timestamp_to_date(time_stamp, format_string="%Y-%m-%d %H:%M:%S"): time_array = time.localtime(time_stamp/1000) other_style_time = time.strftime(format_string, time_array) print other_style_time return other_style_time timestamp_to_date(1593693029909)
輸出
2020-07-02 20:30:29