getWeeksInWeekYear(): This method is available in java.util.Calendar class of Java.
Syntax:
int java.util.Calendar.getWeeksInWeekYear()
This method returns the number of weeks in the week year represented by this Calendar.
Returns: the number of weeks in the week year.
Throws:
UnsupportedOperationException - if any week year numbering isn't supported in this Calendar.
Approach
Java
import java.util.Calendar;public class CalendargetWeeksInWeekYear {public static void main(String[] args) {// create a calendarCalendar calendar = Calendar.getInstance();calendar.add(Calendar.DATE, 2);System.out.println(calendar.getWeeksInWeekYear());}}
Output:
53
No comments:
Post a Comment