0
내가 사용하고있어 funciton이 기능이 제대로 작동 많은 장치에서안드로이드 구문 분석 할 날짜 : 2017년 1월 6일
public static String getFormatedDate(String dateVal) {
String tempDate = null;
Locale systemLocale = Locale.getDefault();
try {
SimpleDateFormat formatter = new SimpleDateFormat("MMM dd, yyyy",
systemLocale);
Date date = (Date) formatter.parse(dateVal);
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
tempDate = sdf.format(date);
} catch (Exception e) {
ApplicationLog.log(TAG, e);
}
return tempDate;
}
이지만, 날짜를 구문 분석하는 동안 장치 중 하나에서 예외가 발생되고있다. 이 예외는 Locale.getDefault()
?과 관련이 있습니까? 그렇다면 변경해야 할 사항은 무엇입니까? 감사.
Utilities.getFormatedDate(date);
가 그리고 예외는 함수를 호출
...
Utilities:java.text.ParseException: Unparseable date: "Jan 06, 2017" (at offset 0)
at java.text.DateFormat.parse(DateFormat.java:579)
전체 스택 추적을 게시 할 수 있습니까? –
또한이 메서드를 호출 할 때 코드를 공유 할 수 있습니까? –
네, 맞습니다. 로케일을 통과하지 마십시오. –