To change a date/time component, use its set method in Java

Description

The following code shows how to to change a date/time component, use its set method.

Example


/*  www . j av  a  2  s .  c  o m*/
import java.util.Calendar;

public class Main {

  public static void main(String[] args) {
    Calendar calendar = Calendar.getInstance();
    calendar.set(Calendar.MONTH, Calendar.DECEMBER);

  }

}




















Home »
  Java Tutorial »
    Date »




Date Get
Date Set
Date Format
Date Compare
Date Convert
Date Calculation
Date Parse
Timezone