0

i want to format date and time with given number like

val time = 4
val hour = 5 

how to write it like that 4:05

String.format("%d:%d", time.hours, time.minutes)
Daniil Pavlenko
  • 123
  • 1
  • 8
Ahsan Ali
  • 89
  • 1
  • 7

1 Answers1

0

use this format:

  String.format("%02d:%02d",time.hours ,time.minutes)

use %02d instead of %d

Bhoomika Patel
  • 1,543
  • 8
  • 25