Skip to content

Instantly share code, notes, and snippets.

@ResolveWang
Created December 12, 2017 09:54
Show Gist options
  • Save ResolveWang/9bb648e87eb159b484315a60ec5850de to your computer and use it in GitHub Desktop.
Save ResolveWang/9bb648e87eb159b484315a60ec5850de to your computer and use it in GitHub Desktop.
使用python获取当天零点的时间戳
def get_zero_timestamp(self):
cur_timestamp = time.time()
cur_time = time.localtime(cur_timestamp)
zero_time_stamp = cur_timestamp - (
cur_time.tm_sec + 60 * cur_time.tm_min + 3600 * cur_time.tm_hour)
return zero_time_stamp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment