0

I am using this to set the time of uilocalnotifications. I want them to trigger at a certain time for whatever timezone the user lives.

NSCalendar *calendar = [NSCalendar autoupdatingCurrentCalendar] ;
NSDateComponents *components = [calendar components: NSUIntegerMax fromDate: date];
[components setHour: 7];
[components setMinute: 59];
[components setSecond: 17];

NSDate *newDate = [calendar dateFromComponents: components];

The minutes and seconds update correctly but the hour is always off. date is the original date passed and fire date is what I get when I attempt to set the time. The minutes and seconds are correct but the hour is off. Any clues?

date 2016-10-29 02:54:18 +0000
firedate 2016-10-28 14:59:17 +0000
Mike Owens
  • 936
  • 3
  • 8
  • 20
  • This answered my question. I forgot that NSLog will always be GMT. http://stackoverflow.com/a/11133736/528828 – Mike Owens Oct 29 '16 at 03:06
  • This answered my question. I forgot that NSLog will always be GMT. http://stackoverflow.com/a/11133736/528828 – Mike Owens Oct 29 '16 at 03:07

0 Answers0