from datetime import datetime
ts = 1415309268
cts = datetime.fromtimestamp(ts)
print(cts.minute==00)
Run Code Online (Sandbox Code Playgroud)
如果你还想要秒:
cts.minute==00 and cts.second==00
Run Code Online (Sandbox Code Playgroud)
时间戳以秒为单位,因此时间模 3600 应为零。
if timestamp % 3600 == 0:
# save the timestamp-value tuple
Run Code Online (Sandbox Code Playgroud)
这足够了,您不必创建日期时间对象并检查您获得的每个时间戳的分钟和秒。