The use of python time zone conversion pytz module and time conversion

The official address of pytz: https://pypi.org/project/pytz/

import pytz 
import datetime 
import time 

#Initialize zero time zone 
tz = pytz.timezone('GMT') 
#Get current system linux timestamp 
timeNow=time.time() 
#Convert current linux time to GMT time zone "Ymd H:i: s" time format toTimes=datetime.datetime.fromtimestamp(int(timeNow),tz).strftime('%Y-%m-%d %H:%M:%S')

 

Guess you like

Origin blog.csdn.net/Dangdangcyuyan/article/details/87783787