Java Day getDayInWeekForMonthIn2Characters(int year, int month)

Here you can find the source of getDayInWeekForMonthIn2Characters(int year, int month)

Description

get Day In Week For Month In Characters

License

Apache License

Parameter

Parameter Description
year a parameter
month 0-11

Declaration

public static List<String> getDayInWeekForMonthIn2Characters(int year, int month) 

Method Source Code

//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;
    }
}

Related

  1. getDayEnd(Date date)
  2. getDayEndTime(int off, String timezone)
  3. getDayForDate(String dateToCheck, String pattern)
  4. getDayFormat(Date date)
  5. getDayInWeekBeginAndEnd(Date date)
  6. getDayName(String dateString)
  7. getDayNameForDate(java.util.Date dt, boolean fullname)
  8. getDayNames(Locale locale)
  9. getDayNumber()