Java Date Compare compare_date2(String finalDate, String enddate)

Here you can find the source of compare_date2(String finalDate, String enddate)

Description

compardate

License

LGPL

Declaration

public static int compare_date2(String finalDate, String enddate) 

Method Source Code


//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;
    }
}

Related

  1. compare(final Date lhs, final Date rhs)
  2. compare(final Date one, final Date another)
  3. compare2Date(Date date1, Date date2)
  4. compare2Dates(Date d1, Date d2)
  5. compare2DateString(String DateStringType, String dateStr1, String dateStr2)
  6. compareCalendars(Date fechaAComparar, Date fechaBase)
  7. compareDate(Date d1, Date d2)
  8. compareDate(Date d1, Date d2)
  9. compareDate(Date d1, Date d2)