Calculate time difference in Cocoa

后端 未结 4 857
逝去的感伤
逝去的感伤 2021-02-04 08:53

I have got two timevalues in the format: %H%M%S (E.G.161500)

These values are text-based integers.

Is there a simple function in Cocoa that calculates the diffe

4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-04 09:37

    try this code.

    - (NSTimeInterval)intervalBetweenDate:(NSDate *)dt1 andDate:(NSDate *)dt2 {
    
    NSTimeInterval interval = [dt2 timeIntervalSinceDate:dt1];
    NSLog(@"%f",interval);
    return interval;
    

    }

提交回复
热议问题