0
NSDate 객체를 문자열 형식으로 변환 중입니다. GHKit
을 사용하십시오. 내부적으로는 stringFromDate
iOS 7 날짜 시간대 문제
[NSDate date] gh_format:@"yyyy-MM-dd HH:mm:ss zzz" useWeekday:NO]
- (NSString *)gh_format:(NSString *)format useWeekday:(BOOL)useWeekday {
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:format];
NSString *formatted = [dateFormatter stringFromDate:self];
if (useWeekday) {
NSString *specialWeekday = [self gh_weekday:dateFormatter];
formatted = [NSString stringWithFormat:@"%@, %@", specialWeekday, formatted];
}
[dateFormatter release];
return formatted;
}
NSDateFormatter
를 사용
이 방법은
2013-10-10 10:43:44 GMT+05:00
그러나 아이폰 OS 7 내 웹 서버 구문 분석 할 수없는 한이 같은 것을 생산하는 다음과 같은 출력을 생성에서 iOS 5, 6으로 잘 작동
2013-10-10 10:43:44 GMT+5