forum

Home / DeveloperSection / Forums / How to Add two HH:mm:ss in iOS?

How to Add two HH:mm:ss in iOS?

Elena Glibart223028-Oct-2014

I tried to look for all possible answers but could not find how to add two times in "HH:mm:ss" format.

I have couple of captured times in an array and I want to return sum of all in HH:mm:ss format as Here is my code:

-(void) addTime
{
   NSMutableArray *recordedArray = [[NSMutableArray alloc]   initWithObjects:@"00:45:12",@"20:08:15",@"00:09:36",@"00:50:20", nil];
   double sumOne = 0;
   for (NSNumber * n in recordedArray)
   {
     sumOne += [n doubleValue];
   }
   NSLog(@"Sum of array time in HH:mm:ss is--> %f", sumOne);
}

Updated on 28-Oct-2014

Can you answer this question?


Answer

1 Answers

Liked By