2013-05-29 3 views
0

이것은 매우 이상합니다.언어 혼합을 제공하는 Joda DateTimeFormatter

나는 형식을

EEE MMM d, yyyy h:mm a 'UTC'ZZ 

을주는 Joda 시간 DateTimeFormatter를 사용하고 있는데는 스페인어와 영어의 혼합물 것으로 보인다

mié may 29, 2013 5:15 PM UTC-06:00 

를 인쇄합니다.

formatLocalDateTime(DateTimeFormat.forPattern("EEE MMM d, yyyy h:mm a 'UTC'ZZ"), dateTime) 



public static String formatLocalDateTime(final DateTimeFormatter formatter, final DateTime dateTime) { 
    if (dateTime == null) { 
     return ""; 
    } 
    DateTimeFormatter f = formatter.withLocale(LocaleUtils.toLocale("es_US")); 
    f = f.withZone(getTimeZone()); 

    return f.print(dateTime); 
} 

나는 완전히 잃어 버렸어. 어떤 아이디어? 감사!

답변

2

그것은 당신의 로케일 - 당신은 "es_US"에 대한 올바른 서식을 얻고있다 - http://www.localeplanet.com/icu/es-US/

당신이 영어를 기대하는 경우, 예를 들면, "ko 페이지" 당신이 원하는 것은 스페인어의 경우 (스페인)를 사용 , http://www.oracle.com/technetwork/java/javase/locales-137662.html

편집에 로케일의 목록은 "ES_ES"

를 사용 - 당신이보고있는 것은 올해의 '짧은'요일 및 월입니다. 당신이 es_US에서 스페인어를 모두있는 '긴'버전을 원하는 경우,

miércoles 29 메이요 얻을 것 형식

"EEEE MMMM d, yyyy h:mm a 'UTC'ZZ" 

을 사용하여 2013 년 세계 협정시 오후 5시 15분-06 : 00

+0

대단히 감사합니다. – iank

관련 문제