Here you can find the source of getDayOfWeek(Date dt)
Parameter | Description |
---|---|
dt | The given Date |
public static String getDayOfWeek(Date dt)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**//from www . jav a2 s . c o m * Get and return the day of week from the given Date dt * * @param dt * The given Date * * @return day The abbreviated String value of the day */ public static String getDayOfWeek(Date dt) { Calendar cal = new GregorianCalendar(); cal.setTime(dt); int dow = cal.get(Calendar.DAY_OF_WEEK); switch (dow) { case 1: 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"; default: return ""; } } }