首页 > 代码库 > 获取当天整点时间戳

获取当天整点时间戳

原文 http://blog.csdn.net/mzbqhbc12/article/details/60886154

 

import time,datetime



def gettime():
    for x in range(24):
            
        a = datetime.datetime.now().strftime("%Y-%m-%d")+" %2d:00:00"%x


        timeArray = time.strptime(a, "%Y-%m-%d %H:%M:%S")

        timeStamp = int(time.mktime(timeArray))
        print(timeStamp)



if __name__ == "__main__":
    gettime()

  

获取当天整点时间戳