Here you can find the source of getIsoDayOfWeek(Date date)
Parameter | Description |
---|---|
date | the date object which day of week should be calculated |
public static int getIsoDayOfWeek(Date date)
//package com.java2s; /*//w w w. j a v a 2 s . com * Copyright 2004-2009 H2 Group. Multiple-Licensed under the H2 License, * Version 1.0, and under the Eclipse Public License, Version 1.0 * (http://h2database.com/html/license.html). * Initial Developer: Robert Rathsack (firstName dot lastName at gmx dot de) */ import java.util.Date; import java.util.Calendar; public class Main { /** * Return the day of week. Week starts at Monday. * * @param date the date object which day of week should be calculated * @return the day of the week, Monday as 1 to Sunday as 7 */ public static int getIsoDayOfWeek(Date date) { Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(date.getTime()); int val = cal.get(Calendar.DAY_OF_WEEK) - 1; return val == 0 ? 7 : val; } }