Here you can find the source of getWeekday(String date)
public static String getWeekday(String date)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static String getWeekday(String date) { SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat sdw = new SimpleDateFormat("E"); Date d = null;/*from w w w .j av a 2 s .c om*/ try { d = sd.parse(date); } catch (ParseException e) { e.printStackTrace(); d = new Date(); } return sdw.format(d); } public static String format(Date aTs_Datetime) { return format(aTs_Datetime, "yyyy-MM-dd"); } public static String format(Date aTs_Datetime, String as_Pattern) { if (aTs_Datetime == null || as_Pattern == null) return null; SimpleDateFormat dateFromat = new SimpleDateFormat(); dateFromat.applyPattern(as_Pattern); return dateFromat.format(aTs_Datetime); } }