当天的零点时间戳

import pymysql,time

connect = pymysql.connect(
host='127.0.0.1',
port=8889,
user='root',
passwd='root',
db='test_date',
charset='utf8'
)
cursor=connect.cursor()

min = 60000

now_time = int(time.time()) #当前时间戳

day_time = now_time - now_time % 86400 + time.timezone #当天的零点时间戳


starttime = now_time*1000+20*min #当前时间加20分钟
time1 = now_time*1000-day_time*1000 #startttime减去当天零点时间
time2= time1+10*min #time1时间往后推10分钟

print starttime,time1,time2



sql = "update room set starttime = {}, rounds = '[{},{}]' where id = {}".format(starttime,time1,time2,1)

print sql
cursor.execute(sql)

connect.commit()
posted @ 2018-09-12 17:58  hayabky  阅读(1708)  评论(0)    收藏  举报