Here you can find the source of getDayOfWeek(String dat)
public static String getDayOfWeek(String dat)
//package com.java2s; import java.util.Calendar; public class Main { public static String getDayOfWeek(String dat) { dat = dat.replaceAll("-", ""); int yy = Integer.valueOf(dat.substring(0, 4)).intValue(); int mm = Integer.valueOf(dat.substring(4, 6)).intValue(); int dd = Integer.valueOf(dat.substring(6)).intValue(); String[] dayOfWeek = { "sun", "mon", "tue", "wed", "thu", "fri", "sat" }; Calendar c = Calendar.getInstance(); c.set(yy, mm - 1, dd);// w w w . jav a2s . c o m return dayOfWeek[c.get(Calendar.DAY_OF_WEEK) - 1]; } }