Created
February 10, 2025 10:34
-
-
Save serge-eric-kalaga/2ae397bec3f2a2e6a48d0a83463cc87b to your computer and use it in GitHub Desktop.
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
from datetime import datetime, timedelta | |
def seconds_until_midnight(): | |
now = datetime.now() | |
# Calculer l'heure de minuit (00:00:00 du lendemain) | |
midnight = (now + timedelta(days=1)).replace( | |
hour=0, minute=0, second=0, microsecond=0 | |
) | |
# Calculer le temps restant en secondes | |
return int((midnight - now).total_seconds()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment