Python 处理 1870 年 epoch time 之前的时间
資深大佬 : songkaiape 3
VMS 时间戳默认时间是 1858 年 11 月 17 日,需要转换为正常的时间戳,如果直接使用 time 读取 18581117 再加上毫秒然后进行转换会导致溢出。百度了一下没找到类似问题解答,所以在 V2 记录一下方便后来遇到类似问题的人。 可以使用 timedelta 就可以避免溢出的问题
import datetime start_date=datetime.datetime.strptime('18581117','%Y%m%d') vms_timestamp=4453016000000000 date=start_date+datetime.timedelta(millisecondes=vms_timestamp/10000) print(date.strftime('%Y%m%d%H%M%S')
大佬有話說 (2)