开发者

iPHONE SDK - Subtracting a time given another time

having trouble with this. i need to come up with a logic code.

How do i, given 2 set of times. subtract one from the other and change it all to seconds.

Lets say i have '12:00:00' and '15:00:00' Now i want to subtract 12:00:00 from 15:00:00 so the result will be 03:00:00. Then change it all to seconds so开发者_开发技巧 that will be 10800 seconds

i already have two sets of time in an NSString after being Formatted with a NSDateFormatter


This is what you need to look for : NSDate -(NSTimeInterval)timeIntervalSinceDate

Convert your string to an NSDate and call this method [thisDate timeIntervalSinceDate:thatDate] will return you an NSTimeInterval, type double

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜