import datetime import time #time_stamp = int(time.time()) time_stamp=1650842803 time_stamp1=time_stamp+8*60*60 loc_time = time.localtime(time_stamp) loc_time1 = time.localtime(time_stamp1) time_1 = time.strftime("%Y-%m-%d %H:%M:%S", loc_time) time_2 = time.strftime("%Y-%m-%d %H:%M:%S", loc_time1) print(loc_time) time.struct_time(tm_year=2022, tm_mon=4, tm_mday=25, tm_hour=7, tm_min=26, tm_sec=43, tm_wday=0, tm_yday=115, tm_isdst=0) print('utc时间戳:', time_stamp) utc时间戳: 1650842803 print('utc转本地时间:', time_1) utc转本地时间: 2022-04-25 07:26:43 print('utc-8时间戳:', time_stamp1) utc时间戳: 1650871603 print('utc-8转本地时间:', time_2) utc转本地时间: 2022-04-25 15:26:43
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)