Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.util.Log;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;
import java.util.Locale;

public class Main {
    public static final String TAG = "ikram";

    private static Boolean currentGreaterThenOld(String currentDate, String oldDate) {
        if (currentDate.isEmpty() || oldDate.isEmpty())
            return false;

        try {
            SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy", Locale.getDefault());
            Date current = formatter.parse(currentDate);
            Date old = formatter.parse(oldDate);

            if (old.compareTo(current) < 0) {
                Log.d(TAG, "compareDate current Date : " + current.toString() + " is greater then Old Date : "
                        + old.toString());
                return true;
            }

        } catch (ParseException e1) {
            e1.printStackTrace();
        }
        return false;
    }
}