Here you can find the source of getWeekOfDay(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static int getWeekOfDay(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static int getWeekOfDay(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from www . ja va 2s. com*/ int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w == 0) { w = Calendar.DAY_OF_WEEK; } else if (w < 0) { w = 0; } return w; } }