public void getDate(String unixDate) { SimpleDateFormat fm1 = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); SimpleDateFormat fm2 = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); long unixLong = 0; String date = ""; try { unixLong = Long.parseLong(unixDate) * 1000; } catch(Exception ex) { System.out.println("String转换Long错误,请确认数据可以转换!"); } try { date = fm1.format(unixLong); date = fm2.format(new Date(date)); } catch(Exception ex) { System.out.println("String转换Date错误,请确认数据可以转换!"); } System.out.println(date); }