Here you can find the source of compare_date2(String finalDate, String enddate)
public static int compare_date2(String finalDate, String enddate)
//package com.java2s; //License from project: LGPL import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static int compare_date2(String finalDate, String enddate) { try {// w w w. j a v a 2 s. co m DateFormat df = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date d1 = df.parse(finalDate); Date d2 = df.parse(enddate); int ss = d1.compareTo(d2); return ss; } catch (ParseException e) { e.printStackTrace(); } return 0; } }