Here you can find the source of getDayInWeekForMonthIn2Characters(int year, int month)
Parameter | Description |
---|---|
year | a parameter |
month | 0-11 |
public static List<String> getDayInWeekForMonthIn2Characters(int year, int month)
//package com.java2s; /*/* w w w . j a va 2s . co m*/ * Copyright 2012 Eng Kam Hon (kamhon@gmail.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.List; public class Main { /** * * @param year * @param month * 0-11 * @return */ public static List<String> getDayInWeekForMonthIn2Characters(int year, int month) { SimpleDateFormat df = new SimpleDateFormat("EE"); List<String> list = new ArrayList<String>(); Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); cal.set(Calendar.DATE, 1); while (cal.get(Calendar.MONTH) == month) { list.add(df.format(cal.getTime())); cal.add(Calendar.DATE, 1); } return list; } }