Android examples for java.util:Week
get week number
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Calendar; import java.util.Date; import android.annotation.SuppressLint; public class Main { @SuppressLint("SimpleDateFormat") public static int get_week_number(String date_str) throws java.text.ParseException { SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Calendar cl = Calendar.getInstance(); Date date = (Date) sdf.parse(date_str); //df.parse(y_m_d) cl.setTime(date);/* www .j a v a 2 s . c o m*/ int week = cl.get(Calendar.WEEK_OF_YEAR); return week; } }