Java Calendar Week getWeekDay(Calendar cal)

Here you can find the source of getWeekDay(Calendar cal)

Description

get Week Day

License

Open Source License

Declaration

public static String getWeekDay(Calendar cal) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Calendar;

public class Main {
    public static String getWeekDay(Calendar cal) {
        int Day_No = cal.get(Calendar.DAY_OF_WEEK);
        String WeekDay = "Sunday";
        switch (Day_No) {
        case Calendar.SUNDAY: {
            WeekDay = "Sun";
            break;
        }/*  w  w  w .  ja v  a  2s  .c  om*/
        case Calendar.MONDAY: {
            WeekDay = "Mon";
            break;
        }
        case Calendar.TUESDAY: {
            WeekDay = "Tue";
            break;
        }
        case Calendar.WEDNESDAY: {
            WeekDay = "Wed";
            break;
        }
        case Calendar.THURSDAY: {
            WeekDay = "Thu";
            break;
        }
        case Calendar.FRIDAY: {
            WeekDay = "Fri";
            break;
        }
        case Calendar.SATURDAY: {
            WeekDay = "Sat";
            break;
        }
        }
        return WeekDay;
    }
}

Related

  1. getFirstOfMonthDayOfWeek(GregorianCalendar aCalendar)
  2. getImmediateDayOfWeek(Calendar current, int dayOfWeek)
  3. getLastDayOfWeek(Calendar cal)
  4. getLastDayOfWeek(Calendar cal)
  5. getWeek(Calendar calendar)
  6. getWeekdayPosition(Calendar jCalendar)
  7. getWeekEnd(boolean startSunday, Calendar date)
  8. getWeekOfCurrentDayWithoutStartShift(Calendar cal)
  9. getWeekStart(boolean startSunday, Calendar date)