Created
October 27, 2023 14:24
-
-
Save Hunter87ff/f44f8900a0aff5ec3163ddc4efb1e351 to your computer and use it in GitHub Desktop.
time format from delta (0:40:45.3456456)
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 time_format(delta): #0:40:45.3456456 | |
delta = str(delta) | |
time = "" | |
lst = delt.split(".")[0].split(":") | |
if(len(lst)<=3): | |
h,m,s = delt.split(".")[0].split(":") | |
time = f"{h}hr, {m}min, {s}sec" | |
elif(len(lst)>3): | |
d,h,m,s = delt.split(".")[0].split(":") | |
time = f"{d}day, {h}hr, {m}min, {s}sec" | |
return time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment