views:

307

answers:

1

hi i am having 2:01:20 PM format in one label,

after some calculations , i need to change the hour, minute , of that label

that is ,

is it possible to change that label value,by converting it as NSDate object and can modify hour , minute like 3:20:30 PM

is there any setter methods to do it.

Thanks in advance.

A: 

If you need to calculate specific real instances in time e.g. 3:20:30 PM Oct 23, 2010, then you want to use NSCalendar which lets you decompose dates and do date related calculations.

Word of warning. Date and time calculations are surprisingly complex and detailed. Expect to spend a couple of hours learning the API.

TechZen
my code isNSDateFormatter *timeFormatter = [[[NSDateFormatter alloc] init] autorelease]; [timeFormatter setDateStyle:NSDateFormatterNoStyle]; [timeFormatter setTimeStyle:NSDateFormatterMediumStyle]; NSDate *stringTime = [NSDate date]; NSString *formattedDateStringTime = [timeFormatter stringFromDate:stringTime]; //NSLog(@"the time string is %@",formattedDateStringTime); time.text = formattedDateStringTime;here , my problem is i need to change the time hour, minute, so, if i follow above comment its too hard, any other classes to make it easy TechZen.Thanks For quick answer.
mac