3
NSDate
오늘 날짜와시, 분, 초를 각각 5, 0 및 0으로 만들려면 어떻게해야합니까? 나는. 날짜는 2010 년 7 월 2 일 05:00:00오늘의 특정 시간과 분에 대한 NSDate 만들기
NSDate
오늘 날짜와시, 분, 초를 각각 5, 0 및 0으로 만들려면 어떻게해야합니까? 나는. 날짜는 2010 년 7 월 2 일 05:00:00오늘의 특정 시간과 분에 대한 NSDate 만들기
//Gives us the current date
NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [gregorian components:NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit fromDate:[NSDate date]];
[components setHour:5];
NSDate * date = [gregorian dateFromComponents:components];
[gregorian release];
일 것입니다. 그 라인을 따라 뭔가가 트릭을해야합니다.
NSCalendar를 사용하는 것이 더 쉽습니다. – VoodooChild