Last active
October 31, 2015 04:36
-
-
Save ryandotclair/57f040b315143d80c0b2 to your computer and use it in GitHub Desktop.
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
# Get today's midnight | |
midnight = datetime.combine(date.today(), dt_time.min) | |
# Convert to unix epoch time | |
unix_midnight = time.mktime(midnight.timetuple()) | |
# Convert to milliseconds | |
unix_midnight *= 1000 | |
# Remove trailing .0 float from the time | |
unix_midnight = str(unix_midnight).replace(".0", "") | |
# Get yesterday's midnight | |
yesterday_midnight = midnight - timedelta(days=1) | |
# Convert to unix epoch time | |
unix_ym = time.mktime(yesterday_midnight.timetuple()) | |
# Convert to milliseconds | |
unix_ym *= 1000 | |
# Remove trailing .0 float from the time | |
unix_ym = str(unix_ym).replace(".0", "") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment