Here you can find the source of compareDateSequence(String startDate, String endDate)
public static int compareDateSequence(String startDate, String endDate)
//package com.java2s; /*/*from w w w . jav a 2 s .co m*/ * ================================================================== * The Huateng Software License * * Copyright (c) 2008-2012 TOPSCF All rights reserved. * ================================================================== */ import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static int compareDateSequence(String startDate, String endDate) { java.util.Date start_Date = numberToDate(startDate); java.util.Date end_Date = numberToDate(endDate); int result = start_Date.compareTo(end_Date); return result; } public static Date numberToDate(String dateString) { if ("".equals(dateString) || dateString == null) { return null; } Date date = null; SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMdd"); try { date = simpleDateFormat.parse(dateString); } catch (ParseException e) { e.printStackTrace(); System.out.println("------SCFDataFormat>>StringTodate error=" + e); } return date; } }