Hey guys,
I got help with correct calculation the other day but I've hit a block about how to implement it into code.
-(IBAction)done:(id)sender {
int result = (([startHours.text intValue] * 60) + [startMinutes.text intValue]) -
(([finishHours.text intValue] * 60) + [finishMinutes.text intValue]);
totalHours.text = [NSString stringWithFormat:@"%i", result / 60];
if (result < 0) {
totalHours.text = [NSString stringWithFormat:@"%d", result * -1];
}
The above is the code. However, in the text field it comes out as the total number of minutes. I want to covert it so it would show up as total hours and minutes (10.30). How would I do that in code?