Joda - "hh:mm AM" 在 "AM" 处格式错误
Joda - "hh:mm AM" is malformed at "AM"
我在我的 android 应用程序中使用 Joda 库来格式化 hh:mm am/pm
到 LocalTime
等字符串,所以我使用这个:
DateTimeFormat.forPattern("hh:mm a").parseLocalTime("6:30 AM");
它工作正常,但是当我改变我的 phone 语言(德语或西班牙语)时它抛出这个异常:
W/System.err﹕ java.lang.IllegalArgumentException: Invalid format: "06:30 AM" is malformed at "AM"
有什么想法吗?
尝试:
DateTimeFormat.forPattern("h:mm aa").parseLocalTime("6:30 AM");
使用语言环境英语试试这个:
DateTimeFormat.forPattern("hh:mm a").withLocale(Locale.ENGLISH).parseLocalTime("6:30 AM");
我在我的 android 应用程序中使用 Joda 库来格式化 hh:mm am/pm
到 LocalTime
等字符串,所以我使用这个:
DateTimeFormat.forPattern("hh:mm a").parseLocalTime("6:30 AM");
它工作正常,但是当我改变我的 phone 语言(德语或西班牙语)时它抛出这个异常:
W/System.err﹕ java.lang.IllegalArgumentException: Invalid format: "06:30 AM" is malformed at "AM"
有什么想法吗?
尝试:
DateTimeFormat.forPattern("h:mm aa").parseLocalTime("6:30 AM");
使用语言环境英语试试这个:
DateTimeFormat.forPattern("hh:mm a").withLocale(Locale.ENGLISH).parseLocalTime("6:30 AM");