Here you can find the source of parseDate(String strDate)
public static Date parseDate(String strDate)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.*; public class Main { public static Date parseDate(String strDate) { long r = 0; try {//from w ww.j ava 2s . c om StringTokenizer token = new StringTokenizer(strDate, " "); String date = token.nextToken(); Date now = java.sql.Date.valueOf(date); r = now.getTime(); try { String time = token.nextToken(); StringTokenizer tkTime = new StringTokenizer(time, ":"); r += Integer.parseInt(tkTime.nextToken()) * 60 * 60 * 1000; r += Integer.parseInt(tkTime.nextToken()) * 60 * 1000; r += Integer.parseInt(tkTime.nextToken()) * 1000; } catch (Exception ex) { r = now.getTime(); } } catch (Exception ex) { return new Date(); } return new Date(r); } public static String getTime() { Date currentTime = new Date(); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String dateString = formatter.format(currentTime); String min; min = dateString.substring(14, 16); return min; } }