我正在使用以下代码来设置日期对象:
NSDate *date = [NSDate date];
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier: NSGregorianCalendar];
NSDateComponents *components = [gregorian components: NSUIntegerMax fromDate: date];
[components setHour: 18];
[components setMinute: 00];
[components setSecond: 00];
reminderDate = [gregorian dateFromComponents: components];
但是,当我 NSLog 提醒日期时,我得到以下输出:
Time: 2012-08-29 17:00:00 +0000
早了一小时,谁能解释我需要做什么才能将正确的日期存储在remindDate中?
谢谢,
泰辛