NSCalendar *calendar = [NSCalendar currentCalendar]; NSDateComponents *components = [[NSDateComponents alloc] init]; [components setYear:year]; [components setMonth:month]; [components setDay:day]; [components setHour:hour]; [components setMinute:minute]; [components setSecond:second]; NSDate *result = [calendar dateFromComponents:components]; [components release];
year/month/day/hour/minute/second 는 int 타입의 정수다. 어휴 NSDate 귀찮아. -_-
관련 링크) [iOS] NSDate에서 날짜와 시간을 알아내기
0 comments:
댓글 쓰기