Android
DateFormat 바꾸기
Birthmark
2021. 2. 2. 15:22
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | public ArrayList<String> printDate(ArrayList<String> list){ SimpleDateFormat input_sdf = new SimpleDateFormat("MMddHHmm"); SimpleDateFormat output_sdf = new SimpleDateFormat("MM/dd HH:mm"); Date date = null; String outputStr; for(int i=0; i<list.size(); i++) { try { date = input_sdf.parse(list.get(i)); } catch (java.text.ParseException e) { e.printStackTrace(); } outputStr = output_sdf.format(date); list.set(i, outputStr); } return list; } | cs |