本文介紹了如何在阿拉伯語語言環境中以簡單日期格式解析日期?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
限時送ChatGPT賬號..
我有來自服務器的日期 &格式為 = "2013-01-20T16:48:43" 我的應用程序支持阿拉伯語和英語語言環境.但是當我將語言環境更改為阿拉伯語時,日期沒有解析它給我解析異常.到現在為止我寫的是
i have date coming from server & is in the format = "2013-01-20T16:48:43" my application support Both Arabic & English Locale. But when i change the locale to Arabic the date is not parsing its giving me parse exception. till now what i have written is
private static Date parseJsonDate(final String string) throws Exception
{
final String change_Locale = Locale.getDefault().getISO3Language();
if (change_Locale.equalsIgnoreCase("ara"))
{
System.out.println(":: Date :::" + string);
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", new Locale("ar"));
System.out.println("new date " + format.parse(string));
return format.parse(string);
推薦答案
不要將你的日期解析成阿拉伯語,它會一直給你錯誤,除了嘗試如下設置 Locale ENGLISH.
Do not parse your date into the Arabic it will give you error alwayz besides try as below by setting the Locale ENGLISH only.
final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ENGLISH);
這篇關于如何在阿拉伯語語言環境中以簡單日期格式解析日期?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!