-1
How to convert a 1234 number representing houras to a string with time format e.g. 12:34 in python?
-1
How to convert a 1234 number representing houras to a string with time format e.g. 12:34 in python?
0
I did as follows for situations where the input number is for example 5
x_fill = str(x).zfill(4)
result = str(x_fill)[:2]+':'+str(x_fill)[2:]
-1
def horas(number):
return str(number)[:2]+':'+str(number)[2:]
horas(1234)
Output: '12:34'
Browser other questions tagged python pandas
You are not signed in. Login or sign up in order to post.
How to convert 5 to 00:05?
– Ricardo Diz
What if it’s 1265? There’s no turning back 12:65.
– Woss
This number represents a time or a number of hours/minutes?
– Woss