public static void main(String[] args) { // 时间文本 String dateText = "2018-04-10T10:33:08.72"; // 格式 SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS"); long time = 0; try { time = formatter.parse(dateText).getTime(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } System.out.println(time); }
参考>http://www.028888.net/archives/2016_01_716.html