Skip to content

Instantly share code, notes, and snippets.

@immmdreza
Created August 25, 2020 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save immmdreza/0c3615ed4da78d96a4eaf68041530720 to your computer and use it in GitHub Desktop.
Save immmdreza/0c3615ed4da78d96a4eaf68041530720 to your computer and use it in GitHub Desktop.
def getClock(second: int):
Second = 0
Minute = 0
Hours = 0
Day = 0
Month = 0
Year = 0
while(second > 0):
if(second < 60):
Second = second
second = 0
continue
second -= 60
Minute += 1
if(Minute >= 60):
Minute -= 60
Hours += 1
if(Hours >= 24):
Hours -= 24
Day += 1
if(Day >= 30):
Day -= 30
Month += 1
if(Month >= 12):
Month -= 12
Year += 1
return {
"year": Year,
"month": Month,
"day": Day,
"hours": Hours,
"min": Minute,
"sec": Second,
}
print(getClock(3600*24*38))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment