0

I need to store a date in the future, using NSDate.

If I use timeInterval (from now) in seconds, am I going to run into problems when crossing summer/winter time.

Is there a way to store, say "this coming Monday at 5.30", in a form which will avoid this problem, so it doesn't matter whether Monday is after putting the clocks back/forward?

(The purpose of this is to delete an appointment date - stored online - once it has passed.)

HenryRootTwo
  • 2,572
  • 1
  • 27
  • 27

1 Answers1

0

Not able to test this as the moment, but you can do something like the following, create a date from specified calendar components:

NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];
[components setCalendar:calendar];
[components setYear:2014];
[components setMonth:6];
[components setDay:18];
[components setHour:5];
[components setMinute:30];

NSDate *yourDate = [calendar dateFromComponents:components];
Mike
  • 9,765
  • 5
  • 34
  • 59