Java Utililty Methods Day Name

List of utility methods to do Day Name

Description

The list of methods to do Day Name are organized into topic(s).

Method

StringdayName(String dayNumber)
day Name
String dayName = null;
switch (new Integer(Integer.parseInt(dayNumber))) {
case (0):
    dayNumber = "Sunday";
case (1):
    dayNumber = "Monday";
case (2):
    dayNumber = "Tuesday";
...
StringdayName(String dayNumber)
Convert day from number to name
String dayName = null;
switch (Integer.parseInt(dayNumber)) {
case (0):
    dayName = "Sunday";
    break;
case (1):
    dayName = "Monday";
    break;
...
StringgetCurrentDayName()
Get current day name (sunday, ...
Calendar cal = new GregorianCalendar();
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
switch (dayOfWeek) {
case 1:
    return "sunday";
case 2:
    return "monday";
case 3:
...
StringgetDayName()
Get the full name of the current day
Calendar cal = Calendar.getInstance();
int day = cal.get(Calendar.DAY_OF_WEEK);
String strDay;
switch (day) {
case Calendar.SUNDAY:
    strDay = "Sunday";
    break;
case Calendar.MONDAY:
...
StringgetDayName(int i)
get Day Name
String dayname = "";
switch (i) {
case Calendar.MONDAY:
    dayname = "M";
    break;
case Calendar.TUESDAY:
    dayname = "T";
    break;
...
StringgetDayName(String code)
get Day Name
int day = Integer.parseInt(code);
switch (day) {
case Calendar.SUNDAY:
    return "Sun";
case Calendar.MONDAY:
    return "Mon";
case Calendar.TUESDAY:
    return "Tue";
...
StringgetDayOfWeekName(int dayOfWeek)
Returns the day of the week name as a String which corresponds to dayOfWeek.
switch (dayOfWeek) {
case Calendar.SUNDAY:
    return "Sunday";
case Calendar.MONDAY:
    return "Monday";
case Calendar.TUESDAY:
    return "Tuesday";
case Calendar.WEDNESDAY:
...
intparseDayName(String twoLetterDayName)
Returns the constant from java.util.Calendar corresponding to the given two-letter day of the week.
if (twoLetterDayName.equals("SU")) {
    return Calendar.SUNDAY;
} else if (twoLetterDayName.equals("MO")) {
    return Calendar.MONDAY;
} else if (twoLetterDayName.equals("TU")) {
    return Calendar.TUESDAY;
} else if (twoLetterDayName.equals("WE")) {
    return Calendar.WEDNESDAY;
...