That doesn't support using words like "hours" and "minutes".
I think regular expressions can help you out. You want the following:
1) a number, any number of spaces, the
word "hours" - the number is the number of hours
2) a number, any number of spaces, the word "minutes" - the number is the number of minutes
3) a combination of the above two
One regular expression with two parts, each optional and each with a capturing group, could help you out quite easily - once you've set up the regex that is. Check out java.util.regex.Pattern and its full Javadoc page.