#!/usr/bin/python
#-*- coding:utf-8 -*-
import datetime
tBeginTime = datetime.datetime.now()
sBegin = tBeginTime.strftime("%Y.%m.%d %H:%M:%S")
...
...
tStopTime = datetime.datetime.now()
sStop = tStopTime.strftime("%Y.%m.%d %H:%M:%S")
print('開始時刻: '+sBegin+'\n'+
'結束時刻: '+sStop+'\n'+
'歷時: '+str(tStopTime-tBeginTime))
# 顯示類似下述
# 開始時間: 2023.05.05 10:19:18
# 結束時間: 2023.05.06 22:46:04
# 歷時: 1 day, 12:26:46.230894
沒有留言:
張貼留言