Reputation: 412
I have 2 EDIT Text in my APP with hours and minutes.
i have that double:
double hour;
try {
hour= Double.parseDouble(dayhour.getText().toString().replace(',', '.'));
} catch (NumberFormatException e) {
hour = 0;
}
double minute;
try {
minute= Double.parseDouble(dayminute.getText().toString().replace(',', '.'));
} catch (NumberFormatException e) {
minute= 0;
}
After get hour value i want convert to minutes. because i want know all time in minutes example: 3:42 = 222 minutes.
What i need do?
Upvotes: 0
Views: 1086
Reputation: 48287
You can try a very elegant way
minute += TimeUnit.HOURS.toMinutes(hour);
Upvotes: 0
Reputation: 1617
1)change hours to minutes
2)Add minutes
double allTime = hour * 60 + minute; // allTime - in minutes
Upvotes: 1