views:

68

answers:

3

Hi all,

I have a number of hours and a number of minutes, and I want a reduce the time of 1 second. So, I think I must create a nsdate object with my time, and after find the method to decrease the time. I looked in the apple documentation but I don't find how to do this.

thanks Alex

A: 

You want NSDateComponents. Note, you need to use it with a specific calendar. A code example is listed on the page to which I linked.

Joshua Nozzi
A: 

Don't reinvent the wheel. There are many open source NSDate additions that you can use here. See here

coneybeare
+3  A: 

You can use this

NSDateFormatter *formatter = [[NSDateFormatter alloc] init]; [formatter setDateFormat:@"MM/dd/yyyy"]; NewDateString = [formatter stringFromDate:[NSDate dateWithTimeIntervalSinceNow:-1]

KiranThorat