Here you can find the source of parseTimeStamp(String timeStamp)
public static long parseTimeStamp(String timeStamp) throws ParseException
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static long parseTimeStamp(String timeStamp) throws ParseException { SimpleDateFormat format = new SimpleDateFormat("yy-MM-dd HH:mm:ss"); Date date;//from ww w . j a v a 2 s . c o m try { date = format.parse(timeStamp); } catch (ParseException e) { SimpleDateFormat optFormat = new SimpleDateFormat("yy-MM-dd HH:mm"); date = optFormat.parse(timeStamp); } return date.getTime(); } }