我從字符串格式的JSON響應中獲取日期,但現在我想將該日期轉換爲日期格式。我如何將這個strActiondate:= 9/28/2015 6:52:41 PM轉換成日期,以便我可以插入Sq-lite數據庫。Android將字符串轉換爲日期
我已經嘗試這樣
strActiondate = jobjVessels.getString("actionDate");
Log.e("strActiondate ", " = " + strActiondate);
try{
DateFormat sdf = new SimpleDateFormat("MM/dd/yyyy");
Date netDate = (new Date(Long.parseLong(strActiondate)));
Log.e("netDate "," = "+netDate);
}
catch(Exception ex){
ex.printStackTrace();
}
我想在相同的格式日期= 9/28/2015 6:52:41 PM