Java Week Day getWeekdayForInt(int value)

Here you can find the source of getWeekdayForInt(int value)

Description

Return a string name for the contants from Calendar.

License

LGPL

Parameter

Parameter Description
value An int value for a weekday

Return

A string containing the name of the weekday or "unknown" if value is below 0 or above 6.

Declaration

public static String getWeekdayForInt(int value) 

Method Source Code

//package com.java2s;
//License from project: LGPL 

import java.util.*;

public class Main {
    /**/*from w ww  .  j  av  a  2 s  .c om*/
     * Return a string name for the contants from <code>Calendar</code>.
     * @param value An int value for a weekday
     * @return A string containing the name of the weekday or "unknown" if value is below 0 or above 6.
     */
    public static String getWeekdayForInt(int value) {

        switch (value) {
        case Calendar.MONDAY:
            return "Monday";
        case Calendar.TUESDAY:
            return "Tuesday";
        case Calendar.WEDNESDAY:
            return "Wednesday";
        case Calendar.THURSDAY:
            return "Thursday";
        case Calendar.FRIDAY:
            return "Friday";
        case Calendar.SATURDAY:
            return "Saturday";
        case Calendar.SUNDAY:
            return "Sunday";
        default:
            return "Unknown";
        }
    }
}

Related

  1. getWeekday(String date)
  2. getWeekDay(String dateString, int weekDay)
  3. getWeekDay(String str)
  4. getWeekDayByDate(Date date)
  5. getWeekDayCN()
  6. getWeekdayName(Date date)
  7. getWeekdayNames()
  8. getWeekdayNames(Locale locale)
  9. getWeekDayNUM()