获取北京时间字符串
作者:互联网
"""获取北京时间"""
import pytz
import time
import datetime
def get_bj_time():
now_bj_time = datetime.datetime.fromtimestamp(int(time.time()), pytz.timezone('Asia/Shanghai'))
now_bj_time = now_bj_time.strftime('%Y-%m-%d %H:%M:%S')
return now_bj_time
if __name__ == '__main__':
t = get_bj_time()
print(t)
标签:__,北京,bj,datetime,获取,time,字符串,import,now 来源: https://www.cnblogs.com/pythonwl/p/16185596.html