Java SQL Date Create getDataMaior(java.sql.Date data1, java.sql.Date data2)

Here you can find the source of getDataMaior(java.sql.Date data1, java.sql.Date data2)

Description

Compara 2 datas e retorna a maior, verificando os nulos.

License

Open Source License

Parameter

Parameter Description
data1 a parameter
data2 a parameter

Declaration

public static java.sql.Date getDataMaior(java.sql.Date data1, java.sql.Date data2) 

Method Source Code

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

public class Main {
    /**// w w  w .  j  a  va2  s  .c  om
     * Compara 2 datas e retorna a maior, verificando os nulos.
     * 
     * @param data1
     * @param data2
     * @return
     */
    public static java.sql.Date getDataMaior(java.sql.Date data1, java.sql.Date data2) {
        if (data1 == null)
            return data2;
        if (data2 == null)
            return data1;
        if (data1.after(data2)) {
            return data1;
        } else {
            return data2;
        }
    }
}

Related

  1. getCurrentDayStartDate(Date date)
  2. getCurrentDBDate()
  3. getCurrentSQLDate()
  4. getCurSQLDate()
  5. getCurSQLDateInString(String pstrDateFormat)
  6. getDateAfter(Date date, Integer after)
  7. getDateAfter(Date date, long offset)
  8. getDateAsString(int month, int date, int year)
  9. getDateFormat()