2013년 8월 29일 목요일

특정일의 년, 월, 일을 int 타입으로 추출

NSDate* now = [NSDate date]; // 현재 Date
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit fromDate:now];
int year = [components year];  // 현재 년도
int month = [components month];// 현재 월
int day = [components day];    // 현재 일

댓글 없음:

댓글 쓰기