Here you can find the source of getDayOfWeek(Timestamp timestamp)
Parameter | Description |
---|---|
timestamp | a parameter |
public static int getDayOfWeek(Timestamp timestamp)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Main { public static int getDayOfWeek(Timestamp timestamp) { Calendar cal = Calendar.getInstance(); Date date = new Date(timestamp.getTime()); cal.setTime(date);/*from w ww.j a v a 2 s . c om*/ int dayForWeek = 0; dayForWeek = cal.get(Calendar.DAY_OF_WEEK); if (dayForWeek == 1) { dayForWeek = 7; } else { dayForWeek = dayForWeek - 1; } return dayForWeek; } }