How to put countDownDuration time from my picker into an integer?

158 views Asked by At

I found how I log the time picked:

- (IBAction)save:(id)sender {

    NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
        [formatter setDateFormat:@"HH:mm"];
        NSLog(@"%@", [formatter stringFromDate:[datePicker date]]);
}

What I want to accomplish is:

I have a model class which is a sub-class of NSManagedObject, this is a class I created from my .model entity.

whenever I click "save" method I want to give the model class the count down time, so each object of this class will have it's countdown time and I can fire it up for each object...

i'm a beginner so it will be helpful if you can give me some guidance in what type of object should I store the count down time selected, and this is why I though putting it inside an integer but from what I see it's not true.

Thanks

1

There are 1 answers

0
esreli On

You will need to extract the components of your NSDate. There's a class that does this: NSDateComponents.

Check out this other S.O. question for some guidance:

NSDate get year/month/day