# coding=utf-8
import time
# 输入当前时间戳,转出今天0点的时间戳def
def get_today_zero_timestamp(now_time):
# 今天0点的时间字符串
timeStamp = float(now_time / 1000)
timeArray = time.localtime(timeStamp)
zeroTime = time.strftime("%Y-%m-%d 00:00:00", timeArray)
# 时间字符串再转为时间戳
timeArray_ex = time.strptime(zeroTime, "%Y-%m-%d %H:%M:%S")
return int(time.mktime(timeArray_ex) * 1000)
if __name__ == "__main__":
now = int(round(time.time() * 1000))
print 'int(round(time.time() * 1000)) = ', str(now)
# 今天0点的时间戳
start_time = get_today_zero_timestamp(now)
print 'start_time = ', str(start_time)
print '----------- &&&&&&&&&&& -------------'
now = int(time.time() * 1000)
print 'int(time.time() * 1000) = ', str(now)
# 今天0点的时间戳
start_time = get_today_zero_timestamp(now)
print 'start_time = ', str(start_time)