Here you can find the source of getWeek(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static Integer getWeek(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { /***// w w w. j a v a2 s .c o m * @param date * @return 1,2,3,4,5,6,7 */ private static int[] chweek = new int[] { 0, 7, 1, 2, 3, 4, 5, 6 }; /** * @param date * @return 1,2,3,4,5,6,7 */ public static Integer getWeek(Date date) { if (date == null) return null; Calendar c = Calendar.getInstance(); c.setTime(date); return chweek[c.get(Calendar.DAY_OF_WEEK)]; } }