Java SQL Date Add addYearsToDate(java.sql.Date date, int years)

Here you can find the source of addYearsToDate(java.sql.Date date, int years)

Description

add Years To Date

License

Open Source License

Declaration

public static java.sql.Date addYearsToDate(java.sql.Date date, int years) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    public static java.sql.Date addYearsToDate(java.sql.Date date, int years) {
        java.sql.Date logicalDate;
        Calendar c = Calendar.getInstance();
        c.setTime(date);//from  ww w.  ja va2 s  .  c  o m
        c.add(Calendar.YEAR, years);

        return new java.sql.Date(c.getTimeInMillis());
    }
}

Related

  1. addDays(Date date, int days)
  2. addDaysToSQLDate(java.sql.Date date, int days)
  3. addMesData(Date dtReferencia, int mes)
  4. addMilliseconds(Date date, int milliseconds)
  5. AddSqlDate(String strDate, int iDays)