int hour = [[array objectAtIndex:0] intValue]; //hour = 17
int min = [[array objectAtIndex:1] intValue]; //min = 51
NSLog(@"hour value is %d",hour);
NSLog(@"min value is %d",min);
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:[NSDate date]];
int year = [components year];
int month = [components month];
int day = [components day];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc]init];
dateFormatter.timeStyle = NSDateFormatterNoStyle;
[components setYear:year];
[components setMonth:month];
[components setDay:day];
[components setHour:hour];
[components setMinute:min];
NSCalendar *cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] ;
NSDate *itemDate = [cal dateFromComponents:components];
NSLog(@"the date is %@",itemDate);
出力: 日付は 2012-11-03 01:00:00 +0000 です。しかし、出力を 2012-11-03 17:51:00 にしたい..どうすれば取得できますか?何が間違っていますか?