Java Calendar get week of year

Description

Java Calendar get week of year

import java.util.Calendar;

public class Main {

  public static void main(String[] args) {
    Calendar gCal = Calendar.getInstance();

    int week = gCal.get(Calendar.WEEK_OF_YEAR);
    // Print the week of the year
    System.out.println(week);//from  w w  w. j a v a 2s.c  o  m

  }
}



PreviousNext

Related