that's for integers, just round your double to an integer
Francesc
10/28/2022, 1:21 AM
that leaves the part from double to 3 sections
m
Milo
10/28/2022, 1:25 AM
for example if I have the value 1 I would like to convert it to the string “010000”.
for example if I have the value 0.333333333333333 I would like to convert it to the string “002000".
f
Francesc
10/28/2022, 1:37 AM
I'll help you out on this one, but you need to bang your head and solve these on your own
Copy code
val value = 2.3416667
val hours = value.toInt()
val minutes = ((value - hours) * 60.0).toInt()
val seconds = ((value - hours - minutes / 60.0) * 3600.0).toInt()
println(hours.toString().padStart(2, '0') + ":" + minutes.toString().padStart(2, '0') + ":" + seconds.toString().padStart(2, '0'))