Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; public class Main { public static String week(Date now) { SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-w"); String strDate = sdfDate.format(now); return strDate; } public static String week() { // Create calendar instance Calendar calendar = Calendar.getInstance(); System.out.println("Current week of this month = " + calendar.get(Calendar.WEEK_OF_MONTH)); System.out.println("Current week of this year = " + calendar.get(Calendar.WEEK_OF_YEAR)); return ""; } }