Calendar.setFirstDayOfWeek()

Date

Calendar.setFirstDayOfWeek( int value) Update the first day of the week of a Calendar.
value : Integer ( required ) value from 1 to 7 to get update the first day of week
package my_proj;
 
import java.util.Calendar;
 
public class my_first {
public static void main(String[] args) {
Calendar my_cal = Calendar.getInstance();// created calendar
System.out.println(my_cal.getWeeksInWeekYear()); // 52
my_cal.setFirstDayOfWeek(1);
System.out.println(my_cal.getWeeksInWeekYear()); // 52
}
}
We used getFirstDayOfWeek() to get the value of first day of week.

If we update the input to setFirstDayOfWeek() to 5 or beyond then the output of getWeeksInWeekYear() will change.
package my_proj;
 
import java.util.Calendar;
 
public class my_first {
public static void main(String[] args) {
Calendar my_cal = Calendar.getInstance();// created calendar
System.out.println(my_cal.getWeeksInWeekYear()); // 52
my_cal.setFirstDayOfWeek(5);
System.out.println(my_cal.getWeeksInWeekYear()); // 53
}
}
getLeastMaximum() getActualMaximum() Date & time tutorials


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here




    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer