Here you can find the source of getShortWeekday(int dayOfWeek)
Parameter | Description |
---|---|
dayOfWeek | - values from 1 to 7 accepted (1 =Sunday, 7 = Saturday, 0 = empty) |
public static String getShortWeekday(int dayOfWeek)
//package com.java2s; /*//from w ww . j av a2s . c om * Copyright 2009-2011 Telkku.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.DateFormatSymbols; import java.util.*; public class Main { /** * Returns the short name of the weekday. * @param dayOfWeek - values from 1 to 7 accepted (1 =Sunday, 7 = Saturday, 0 = empty) * */ public static String getShortWeekday(int dayOfWeek) { return getShortWeekday(dayOfWeek, Locale.getDefault()); } /** * Returns the short name of the weekday. * @param dayOfWeek - values from 1 to 7 accepted (1 =Sunday, 7 = Saturday, 0 = empty) * */ public static String getShortWeekday(int dayOfWeek, Locale locale) { DateFormatSymbols symbols = new DateFormatSymbols(locale); String[] shorts = symbols.getShortWeekdays(); String today = shorts[dayOfWeek]; today = today.substring(0, 1).toUpperCase() + today.substring(1, today.length()).toLowerCase(); //First letter upper case, others lower case return today; } }