python時間處理彙總

日期時間處理模塊:

    time

    calendar


當前時間戳: time.time()    以秒爲單位的小數


日期範圍:1970-01-01 到  2038年


時間元組:


獲取當前時間戳:time.time()

獲取當前時間的時間元組:time.localtime(時間戳)

獲取格式化日期:time.strftime("%Y-%m-%d %H:%M:%S",時間元組)

str = "2016-10-10 10:10:10"

字符串轉時間元組:time.strptime(str,"%Y-%m-%d %H:%M:%S")

時間元組轉時間戳:time.mktime(時間元組)



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章