Format a string that matcher found

0

I'm using matcher to pick different patterns of time, but when I write it, I'd like it to be written in the correct format, I tried using SimpleDateFormat ("HH: mm: ss"), but it did not work.

For example: The matcher found 17: 4441 in the text. I need somehow when I rewrite this String it returns 17:44:41;

    
asked by anonymous 05.07.2016 / 18:43

1 answer

1
StringBuilder format = new StringBuilder();
   format.append(hora.substring(0, 2)).
   append(":").append(hora.substring(2, 4)).
   append(":").append(hora.substring(4, 6));
   System.out.println("Hora: " +format);

I was able to format the time the matcher returned to me

    
28.10.2016 / 14:38