Java Date Compare compareDate(String date0, String date1)

Here you can find the source of compareDate(String date0, String date1)

Description

compare Date

License

Open Source License

Declaration

public static int compareDate(String date0, String date1) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

    public static int compareDate(String date0, String date1) {
        SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yyyy");
        try {//from   w  w  w .  ja v a  2 s .c o  m
            Date dt0 = sdf.parse(date0);
            Date dt1 = sdf.parse(date1);
            return dt0.compareTo(dt1);
        } catch (Exception ex) {
            ex.printStackTrace();
            return 1;
        }
    }
}

Related

  1. compareDate(Date start, Date end)
  2. compareDate(String begingDate, String endDate, String format)
  3. compareDate(String d1, String d2)
  4. compareDate(String d1, String d2)
  5. compareDate(String date)
  6. compareDate(String date1, File file)
  7. compareDate(String date1, String date2)
  8. compareDate(String DATE1, String DATE2)
  9. compareDate(String s, String e)