Java GregorianCalendar add days

Description

Java GregorianCalendar add days

import java.util.Calendar;
import java.util.GregorianCalendar;

public class Main {
  public static void main(String[] args) {
    GregorianCalendar gc = new GregorianCalendar();
    System.out.println("Date:" + gc.getTime());
    // Add 15 days 
    gc.add(Calendar.DATE, 15);//  w ww .j a  v  a2s  . com
    System.out.println("Date:"+gc.getTime());

  }
}



PreviousNext

Related