I'd like to make a countdown to the next full hour. It's pretty easy to countdown to a specific time, like:
NSDate *midnight = [NSDate dateWithNaturalLanguageString:@"midnight tomorrow"];
how do I define an NSDate for "the beginning of every hour"?
Thanks!
EDIT: This is what I have currently. Having trouble integrating the solutions in to my code. Any help would be greatly appreciated. :)
-(void)updateLabel {
NSDate *now = [NSDate date];
NSDate *midnight = [NSDate dateWithNaturalLanguageString:@"midnight tomorrow"];
//num of seconds between mid and now
NSTimeInterval timeInt = [midnight timeIntervalSinceDate:now];
int hour = (int) timeInt/3600;
int min = ((int) timeInt % 3600) / 60;
int sec = (int) timeInt % 60;
countdownLabel.text = [NSString stringWithFormat:@"%02d:%02d:%02d", hour, min,sec];
}