2016-01-13 48 views
0

我想以UTC格式轉換我的日期,爲此我必須使用SimpleDateFormat類來解析它。但它給了我無法解析的日期異常。我下面的代碼給出:java.text.ParseException:日期UTC轉換時的無法解析的日期異常

//My date coming from server: Wed Dec 23 13:00:00 GMT+04:00 2015 

SimpleDateFormat simpleDateFormat = new SimpleDateFormat("dd MM EE- HH:mm:ss yy"); 
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); 
Date myDate = simpleDateFormat.parse(s1.datefrom + ""); 
+0

什麼是S1? – NAIT

+0

s1是我從中得到我的約會的對象。 –

回答

0

我認爲這應該工作:SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd HH:mm:ss Z yyyy",Locale.US);

相關問題