Here you can find the source of getEnglishDayInWeek(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static char getEnglishDayInWeek(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**// w w w . j a v a 2s . co m * Returns the first letter of day in week. * For example, Monday will return 'M'. * @param date * @return */ public static char getEnglishDayInWeek(Date date) { Calendar c = Calendar.getInstance(); c.setTime(date); int dayInWeek = c.get(Calendar.DAY_OF_WEEK); switch (dayInWeek) { case Calendar.MONDAY: return 'M'; case Calendar.TUESDAY: return 'T'; case Calendar.WEDNESDAY: return 'W'; case Calendar.THURSDAY: return 'T'; case Calendar.FRIDAY: return 'F'; case Calendar.SATURDAY: return 'S'; case Calendar.SUNDAY: default: return 'S'; } } }