从时间戳开始的PYTHON分钟数

2024-04-26 12:56:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我只需要一个十进制系统来精确计算时间。在

所以我需要一个函数来返回时间戳的分钟数(对于时间戳,我的意思是1/1/1970)。在

它必须非常简单,相反,我从25分钟开始搜索!在


Tags: 函数系统时间
2条回答
import time
print(int(time.time() / 60))

23078330
import datetime as DT
def minutes(timestamp=None):
    """ Return integral number of minutes from the Epoch, 1970-1-1 """
    if timestamp is None:
        now = DT.datetime.now()
        timestamp = now.timestamp()
    return timestamp//60

print(minutes())

相关问题 更多 >