我想获取昨天linux时间戳的开始时间和结束时间
import time
startDay = time.strftime('%Y-%m-%d 00:00:00')
print startDay
endDay =time.strftime('%Y-%m-%d 23:59:59')
print endDay
Output is:
2016-11-18 00:00:00
2016-11-18 23:59:59
这在字符串中显示今天的开始时间和结束时间 我想在 linux 时间戳中获取昨天的开始时间和结束时间 喜欢:
4319395200
4319481599
最佳答案
import time
def datetime_timestamp(dt):
time.strptime(dt, '%Y-%m-%d %H:%M:%S')
s = time.mktime(time.strptime(dt, '%Y-%m-%d %H:%M:%S'))
return int(s)
关于python - 时间戳 python 中昨天的开始和结束时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40672243/