POO dates format
This commit is contained in:
parent
0da1e9b841
commit
cef84de042
Binary file not shown.
|
@ -15,10 +15,10 @@ public class SecsToHMS {
|
||||||
System.out.println("Introduza os segundos totais: ");
|
System.out.println("Introduza os segundos totais: ");
|
||||||
int totalSecs = (int) UserInput.getPositiveNumber(sin);
|
int totalSecs = (int) UserInput.getPositiveNumber(sin);
|
||||||
int secs = totalSecs % 60;
|
int secs = totalSecs % 60;
|
||||||
int mins = Math.round((float) (totalSecs / 60));
|
int mins = totalSecs / 60;
|
||||||
int hours = Math.round((float) (mins / 60));
|
int hours = mins / 60;
|
||||||
mins = mins % 60;
|
mins = mins % 60;
|
||||||
System.out.printf("%d segundos no formato hh:mm:ss : %d:%d:%d\n", totalSecs, hours, mins, secs);
|
System.out.printf("%d segundos no formato hh:mm:ss : %02d:%02d:%02d\n", totalSecs, hours, mins, secs);
|
||||||
|
|
||||||
sin.close();
|
sin.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue