Here you can find the source of getTimeFromString(String time)
public static long getTimeFromString(String time)
//package com.java2s; //License from project: Open Source License import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static String dateFormatString = "MM/dd/yyyy HH:mm:ss"; public static long getTimeFromString(String time) { SimpleDateFormat format = new SimpleDateFormat(dateFormatString); try {/*from w w w . jav a 2 s.c o m*/ Date date = format.parse(time); return date.getTime(); } catch (Exception e) { throw new RuntimeException(e); } } }