Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.text.DateFormat;
import java.text.SimpleDateFormat;

public class Main {
    public static String bigTime(String date1, String date2, String format) {
        DateFormat dateFormat = new SimpleDateFormat(format);
        try {
            if (dateFormat.parse(date1).compareTo(dateFormat.parse(date2)) == 1) {
                return date1;
            } else {
                return date2;
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }
}