Skip to content

Instantly share code, notes, and snippets.

@ayuLiao
Last active November 8, 2018 06:58
Show Gist options
  • Select an option

  • Save ayuLiao/c65e53984944061e307636e15e2f0cc1 to your computer and use it in GitHub Desktop.

Select an option

Save ayuLiao/c65e53984944061e307636e15e2f0cc1 to your computer and use it in GitHub Desktop.
python获得当天时间戳的差值
def get_today():
'''
Get today timestamp
:return:
'''
today = datetime.date.today()
today_timestamp = int(time.mktime(today.timetuple()))
now_timestamp = int(time.time())
# yesterday = today - datetime.timedelta(days=1)
# yesterday_timestamp = int(time.mktime(yesterday.timetuple()))
return today_timestamp,now_timestamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment