QDateTime计算时间差

QDateTime计算时间差

from PyQt5.QtCore import QDateTime

# Create two QDateTime objects
dt1 = QDateTime.currentDateTime()
dt2 = QDateTime(2022, 1, 1, 0, 0)

# Calculate the difference in seconds
diff_seconds = dt1.secsTo(dt2)

print(f'The difference in seconds is {diff_seconds}')

 

 

#####################

posted @ 2023-04-02 17:55  西北逍遥  阅读(208)  评论(0编辑  收藏  举报