Oct-27-2020, 07:13 PM
Hi,
I'm converting seconds to HH:MM:SS and having a hard time converting a remainder (seconds) to an integer to a string
.
I found this code online and it looks good but I cannot join it as a string HH:MM:SS because I cannot convert a remainder (seconds) ->int ->string.
Here is the code:
I'm converting seconds to HH:MM:SS and having a hard time converting a remainder (seconds) to an integer to a string
.I found this code online and it looks good but I cannot join it as a string HH:MM:SS because I cannot convert a remainder (seconds) ->int ->string.
Here is the code:
sec = 50007
sec_value = int(sec % (24 * 3600))
hour_value = str(int(sec_value // 3600))
sec_value %= (int(3600))
min = str(int(sec_value // 60))
sec_value %= 60
print("Converted hours: ",hour_value)
print("Converted minutes:",min)
print("Converted seconds:",sec_value)
print ("Cannot add Seconds. Only hours and minutes : "+hour_value+":"+min+":"+"Seconds here")Thank you!

.