Example usage for java.util Calendar getWeeksInWeekYear

List of usage examples for java.util Calendar getWeeksInWeekYear

Introduction

In this page you can find the example usage for java.util Calendar getWeeksInWeekYear.

Prototype

public int getWeeksInWeekYear() 

Source Link

Document

Returns the number of weeks in the week year represented by this Calendar .

Usage

From source file:Main.java

public static void main(String[] args) {

    Calendar now = Calendar.getInstance();

    System.out.print(now.getWeeksInWeekYear());
}

From source file:Test.java

public static void main(String[] args) {
    Calendar calendar = Calendar.getInstance();
    if (calendar.isWeekDateSupported()) {
        System.out.println("Number of weeks in this year: " + calendar.getWeeksInWeekYear());
        System.out.println("Current week number: " + calendar.get(Calendar.WEEK_OF_YEAR));
    }/*w  w  w.j  a v  a2 s. c om*/

    calendar.setWeekDate(2012, 16, 3);
    System.out.println(
            DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.LONG).format(calendar.getTime()));

}