Here you can find the source of getMisSecond(String strDate)
public static long getMisSecond(String strDate)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static long getMisSecond(String strDate) { return getDate(strDate, "yyyy-MM-dd HH:mm:ss").getTime(); }/* w ww .j a va 2s . co m*/ public static long getTime(Date dateParam) { if (dateParam == null) { throw new IllegalArgumentException("The dateParam must not be null"); } Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dateParam.getTime()); int hour = cal.get(Calendar.HOUR); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); long result = hour * 3600 * 1000 + minute * 60 * 1000 + second * 1000; return result; } public static int getDate(Date dateParam) { if (dateParam == null) { throw new IllegalArgumentException("The dateParam must not be null"); } Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(dateParam.getTime()); return cal.get(Calendar.DAY_OF_MONTH); } public static Date getDate(String strDate, String format) { if (strDate == null || format == null) { throw new IllegalArgumentException("The strDate or the format must not be null"); } SimpleDateFormat dateFormat = new SimpleDateFormat(format); try { return dateFormat.parse(strDate); } catch (Exception e) { e.printStackTrace(); return new Date(); } } public static Date getDate(String strDate) { return getDate(strDate, "yyyy-MM-dd HH:mm:ss"); } }