compare two Date value - Android java.util

Android examples for java.util:Date Compare

Description

compare two Date value

Demo Code


//package com.java2s;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    private static SimpleDateFormat chineseDateFormat = new SimpleDateFormat(
            "yyyy?MM?dd?");

    public static boolean compare(Date compareDate, Date currentDate) {
        return chineseDateFormat.format(compareDate).compareTo(
                chineseDateFormat.format(currentDate)) >= 0;
    }/*  www. j  a v a  2  s  .  co  m*/
}

Related Tutorials