Created
August 14, 2020 13:55
-
-
Save Krakenus/eddee4f7ee2ddc3c6bfe48adb32182bb to your computer and use it in GitHub Desktop.
Get seconds remaining to midnight from current time
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
def seconds_to_midnight() -> int: | |
now = datetime.now() | |
midnight = now + timedelta(days=1) | |
midnight = midnight.replace(hour=0, minute=0, second=0, microsecond=0) | |
return (midnight - now).seconds |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment