// 2015-12-09T05:19:35Z
public static long convert2long(String time) { try { DateTimeFormatter parser = ISODateTimeFormat.dateTimeNoMillis();
DateTime dateTime = parser.parseDateTime(time); Date d = dateTime.toDate(); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Log.d("MainActivity", "time :" + sf.format(d)); Log.d("MainActivity", "time long :" + d.getTime()); return d.getTime(); } catch (Exception e) { e.printStackTrace(); } return 0l; }
需要joda-time-2.1.jar,大家可以按照此方法转换成当前的时间,在这里也是备忘一下