나는 2010-10-11 0시 0분 0초왜 NSCalendar의 dateFromComponents가 잘못된 날짜를 반환합니까?
을 기대하고있다하지만 그 대신 내가 아는 2010-10-10 21시 0분 0초 0000
내가 몇 시간을 추가 할 수 있습니다, 받아 원하는 날짜를받습니다. 그러나 전날 21 시간으로 전날을 얻는 이유를 모르겠습니다 ...
도와주세요!
NSDateComponents *comps = [[NSDateComponents alloc] init];
[comps setYear:2010];
[comps setMonth:10];
[comps setDay:11];
[comps setHour:0];
[comps setMinute:0];
[comps setSecond:0];
NSCalendar *cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDate *retDate = [cal dateFromComponents:comps];
이 그래, 당신 말이 맞아이 필요 해요! \t [cal setTimeZone : [NSTimeZone timeZoneWithAbbreviation : @ "GMT"]]; 문제를 해결했습니다 –
흠 ... coool ... :) – KingofBliss