Here you can find the source of getWeekDay()
public static String getWeekDay()
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static String getWeekDay() { String weekday;/*from w w w . j a v a 2 s.c om*/ Date date = new Date(); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int week_index = calendar.get(Calendar.DAY_OF_WEEK) - 1; switch (week_index) { case 0: { weekday = "sunday"; break; } case 1: { weekday = "monday"; break; } case 2: { weekday = "tuesday"; break; } case 3: { weekday = "wensday"; break; } case 4: { weekday = "thursday"; break; } case 5: { weekday = "friday"; break; } case 6: { weekday = "saturday"; break; } default: { weekday = "monday"; break; } } return weekday; } }