I need to get the proper value of hours from a time string. Here is sample code:
String startTime = "10:00";
int hours = Integer.valueOf(startTime.substring(0,1));
The problem is that for this example, hours is equal to 1 instead of 10. As another example, with startTime = "01:00", then hours is equal to 0 instead of 1. How can I properly determine the hours as an integer from the string?
hm[0]has the hour part, andhm[1]has the minutes.