Java tutorial
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; import java.util.Locale; public class Main { public static int getWeekNum() { int num = 1; try { SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.CHINA); long to = new Date().getTime(); long from = df.parse("2014-9-8 00:00:00").getTime(); num = (int) Math.ceil((to - from) * 1.0 / (1000 * 60 * 60 * 24) / 7.0); } catch (Exception e) { e.printStackTrace(); } return num; } }