Example usage for java.util Calendar isWeekDateSupported

List of usage examples for java.util Calendar isWeekDateSupported

Introduction

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

Prototype

public boolean isWeekDateSupported() 

Source Link

Document

Returns whether this Calendar supports week dates.

Usage

From source file:Main.java

public static void main(String[] args) {

    Calendar now = Calendar.getInstance();

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

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  .jav  a  2 s  . c o m

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

}