Think before you speak, read before you think.

python获取昨天日期时间戳

snippet

import datetime
yesterday = datetime.datetime.now() - datetime.timedelta(days=1)
yesterday_formatted = yesterday.strftime("%Y-%m-%d")

python 生成时间戳

import time
now = int(time.time())

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *