Java Week Day getDayOfWeekShortString(Date date)

Here you can find the source of getDayOfWeekShortString(Date date)

Description

get Day Of Week Short String

License

Apache License

Declaration

public static String getDayOfWeekShortString(Date date) 

Method Source Code

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

import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getDayOfWeekShortString(Date date) {
        int dayOfWeek = getDayOfWeek(date);
        switch (dayOfWeek) {
        case 1://  w w w .j  ava  2 s  .  c  o  m
            return "Sun";
        case 2:
            return "Mon";
        case 3:
            return "Tue";
        case 4:
            return "Wed";
        case 5:
            return "Thu";
        case 6:
            return "Fri";
        case 7:
            return "Sat";
        }
        return null;
    }

    public static int getDayOfWeek(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar.get(Calendar.DAY_OF_WEEK);
    }
}

Related

  1. getDayOfWeek(String dat)
  2. getDayOfWeek(String date)
  3. getDayOfWeek(String year, String month, String day)
  4. getDayOfWeekAbbreviation(int day)
  5. getDayOfWeekAbreviated(Date d)
  6. getDaysExceptWeekend(String from, String to)
  7. getDayWithWeek(Date date)
  8. getENWeekDay()
  9. getFirstday_Lastday_Week()