Here you can find the source of getWeekNumber(String sdate)
public static int getWeekNumber(String sdate)
//package com.java2s; //License from project: Open Source License import java.text.ParsePosition; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static int getWeekNumber(String sdate) { Date date = strToDate(sdate); Calendar c = Calendar.getInstance(); c.setTime(date);/*from www . java 2 s.c o m*/ return c.get(Calendar.DAY_OF_WEEK); } public static Date strToDate(String strDate) { return strToDate(strDate, "yyyy-MM-dd"); } public static Date strToDate(String strDate, String format) { if (strDate == null) { return null; } SimpleDateFormat formatter = new SimpleDateFormat(format); ParsePosition pos = new ParsePosition(0); Date strtodate = formatter.parse(strDate, pos); return strtodate; } }