Here you can find the source of getStartDayOfWeekNo(int year, int weekNo)
Parameter | Description |
---|---|
year | a parameter |
weekNo | a parameter |
public static String getStartDayOfWeekNo(int year, int weekNo)
//package com.java2s; /**/*from ww w. j ava2 s. c om*/ * Copyright (c) 2012-2014 http://www.eryansky.com * * Licensed under the Apache License, Version 2.0 (the "License"); */ import java.util.Calendar; public class Main { /** * get start date of given week no of a year * * @param year * @param weekNo * @return */ public static String getStartDayOfWeekNo(int year, int weekNo) { Calendar cal = getCalendarFormYear(year); cal.set(Calendar.WEEK_OF_YEAR, weekNo); return cal.get(Calendar.YEAR) + "-" + (cal.get(Calendar.MONTH) + 1) + "-" + cal.get(Calendar.DAY_OF_MONTH); } /** * get Calendar of given year * * @param year * @return */ private static Calendar getCalendarFormYear(int year) { Calendar cal = Calendar.getInstance(); cal.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY); cal.set(Calendar.YEAR, year); return cal; } }