Here you can find the source of getWeekNumner(String date)
public static Integer getWeekNumner(String date)
//package com.java2s; //License from project: Open Source License import java.text.DateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static Integer getWeekNumner(String date) { Integer weekNumber = 0;/* w ww . j a va 2s .c o m*/ try { if (date.equals("")) { return weekNumber; } DateFormat formatter = new java.text.SimpleDateFormat("yyyy-MM-dd"); Date passedDate = formatter.parse(date); Calendar cal = Calendar.getInstance(); cal.setTime(passedDate); weekNumber = cal.get(Calendar.WEEK_OF_YEAR); } catch (Exception ex) { ex.printStackTrace(); System.out.println("Error While fetching week number for " + date); } return weekNumber; } }