Last active
November 8, 2018 06:58
-
-
Save ayuLiao/c65e53984944061e307636e15e2f0cc1 to your computer and use it in GitHub Desktop.
python获得当天时间戳的差值
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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