Here you can find the source of parseDateToLong2(String dateString)
public static long parseDateToLong2(String dateString)
//package com.java2s; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { private static final String FORMAT_DATE_YYYY_MM_DD = "yyyy-MM-dd"; public static long parseDateToLong2(String dateString) { SimpleDateFormat sdf = new SimpleDateFormat(FORMAT_DATE_YYYY_MM_DD); Date date;/*from www . j av a2s. co m*/ try { date = sdf.parse(dateString); return date.getTime(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return 0; } }