Here you can find the source of getWeekdayOfDateTime(String datetime)
public static int getWeekdayOfDateTime(String datetime)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static int getWeekdayOfDateTime(String datetime) { DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); Calendar c = Calendar.getInstance(); try {/* w w w . jav a2 s . c om*/ c.setTime(df.parse(datetime)); } catch (Exception e) { e.printStackTrace(); } int weekday = c.get(Calendar.DAY_OF_WEEK) - 1; return weekday; } }