Here you can find the source of getCurWeek(String day)
public static int getCurWeek(String day)
//package com.java2s; //License from project: Open Source License import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static int getCurWeek(String day) { SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); Date date = null;//from w ww. j ava 2s. c o m if (day != null) { try { date = format.parse(day); } catch (ParseException e) { e.printStackTrace(); } } else { date = new Date(); } Calendar calendar = Calendar.getInstance(); calendar.setFirstDayOfWeek(Calendar.MONDAY); calendar.setTime(date); return calendar.get(Calendar.WEEK_OF_YEAR); } }