hello with all I have the following code in java to capture the time and minutes, the code works, it returns me the time and the minutes of the system but, in hours and minutes less than 10 it returns me only a digit without including the zero to the left, please I need help to solve this detail. For example, it shows 9: 6, and I would like it to appear 09:06.
Calendar Cal = Calendar.getInstance();
String fec = Cal.get(Cal.HOUR_OF_DAY) + ":" + Cal.get(Cal.MINUTE);
txtHoraSalida.setText(fec);