Here you can find the source of dayForWeek(String pTime)
public static int dayForWeek(String pTime)
//package com.java2s; //License from project: Apache License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; public class Main { public static int dayForWeek(String pTime) { SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd"); Calendar c = Calendar.getInstance(); int dayForWeek = 0; try {/* w ww .j a v a 2 s .c o m*/ c.setTime(format.parse(pTime)); if (c.get(Calendar.DAY_OF_WEEK) == 1) { dayForWeek = 7; } else { dayForWeek = c.get(Calendar.DAY_OF_WEEK) - 1; } } catch (ParseException e) { e.printStackTrace(); } return dayForWeek; } }