날짜를 현지화하려고했지만 어떤 이유로 일부 지역에서 올바른 형식을 출력하지 않습니다. 이것은 내 코드를 테스트하는 방법이다NSDateFormatter가 지역에 따라 날짜가 일치하지 않습니다.
: 여기
if(dateformater==nil)
dateformater =[[NSDateFormatter alloc] init];
[dateformater setLocale:[NSLocale currentLocale]];
[dateformater setDateStyle:NSDateFormatterMediumStyle];
[dateformater setTimeStyle:NSDateFormatterShortStyle];
NSString *string_date=[dateformater stringFromDate:date];
NSLog(@"Loacle:----%@ Date:----%@",[[NSLocale currentLocale] localeIdentifier],string_date);
는 지역화 된 날짜 모양을 몇 가지 예이며, 여기서 잘못.
Loacle:----da_DK Date:----24/11/2011 14.10--------(WRONG)
Loacle:----en_BE Date:----24 Nov 2011 14:09--------(OK)
Loacle:----nl_BE Date:----24-nov.-2011 14:10------(WRONG)
Loacle:----fr_BE Date:----24 nov. 2011 14:11-------(OK)
Loacle:----en_US Date:----Nov 24, 2011 2:11 PM-----(OK)
Loacle:----en_GB Date:----24 Nov 2011 14:11--------(OK)
요구 사항에는 모든 지역에 대해 일관성을 유지해야한다고 명시되어 있습니다.
왜 "잘못된"줄이 잘못 되었는 지 설명하십시오. – vocaro
나는 loacale에 대한 일관된 수단을 원합니다 en_BE 구분 기호를 얻지 않고 월 기호를 얻지 만 da_DK는 날짜가 구분 기호로 바뀌고 11 월 대신 11 일이됩니다 – Narayana