Data mask

1

I am using a JFormattedTextField with the mask (##: ##) so that the user enters a time and my program searches the database returning the corresponding values at that time.

My problem is that in the database the information is without the ":", ie if the user enters "15:00" will not return anything, since it is registered as 1500. The format of the time data in the database are INT.

Does anyone have an idea how I can solve this?

Thank you

    
asked by anonymous 03.12.2016 / 00:06

1 answer

1

You can use the replace() method.

Example:

String hora = "15:00";
String novaHora = hora.replace(":", "");
    
03.12.2016 / 00:09