Created
October 8, 2018 22:34
-
-
Save mnguyenngo/7b28b99e96b7bcf9ea3f29eb3ae85177 to your computer and use it in GitHub Desktop.
Working with time in Python
This file contains 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
import datetime | |
import time | |
# get current date in format yymmdd; useful for naming files | |
today = datetime.date.today().strftime("%y%m%d") | |
# get current unix time in seconds as integer | |
now = int(time.time()) | |
# get time at midnight for current day in seconds as integer | |
midnight = int(datetime.date.today().strftime("%s")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment