Here you can find the source of getDayOfWeek(String f)
public static Integer getDayOfWeek(String f)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Integer getDayOfWeek(String f) { Integer dayOfWeek;// w w w .jav a2 s.c o m try { SimpleDateFormat format1 = new SimpleDateFormat("MM/dd/yyyy"); Date dt1 = format1.parse(f); DateFormat format2 = new SimpleDateFormat("u"); dayOfWeek = Integer.valueOf(format2.format(dt1)); } catch (Exception ex) { dayOfWeek = new Integer(-1); } return dayOfWeek; } }