Java Calendar get Year

Description

Java Calendar get Year

import java.util.Calendar;

public class Main {
  public static void main(String[] argv) {
    System.out.println(getNowYear());
  }//from w  ww.j  a  va 2s  .  c o  m

  public static int getNowYear() {
    Calendar cc = Calendar.getInstance();
    return cc.get(Calendar.YEAR);
  }
}



PreviousNext

Related