##### python datetime使用
# 秒级时间戳 def log_last_one_time(minutes=60): time = (datetime.datetime.now()-datetime.timedelta(minutes=minutes)).strftime("%Y-%m-%d %H") print(time) dt = datetime.datetime.strptime(time, '%Y-%m-%d %H') return datetime.datetime.timestamp(dt) # 秒级时间戳 def log_current_time(): time = datetime.datetime.now().strftime("%Y-%m-%d %H") print(time) dt = datetime.datetime.strptime(time, '%Y-%m-%d %H') return datetime.datetime.timestamp(dt) def str_to_timestamp(s): dt = datetime.datetime.strptime(s, '%Y-%m-%d %H:%M:%S') return datetime.datetime.timestamp(dt)