Here you can find the source of dayOfWeek(int year, int month, int day)
Parameter | Description |
---|---|
year | a parameter |
month | a parameter |
day | a parameter |
public static int dayOfWeek(int year, int month, int day)
//package com.java2s; public class Main { /**// w w w . j a va 2 s . c o m * Day of week. Mon Tue ... Sun : 1 2 ... 7 * * @param year * @param month * @param day * @return */ public static int dayOfWeek(int year, int month, int day) { if (month == 1 || month == 2) { month += 12; year--; } return (day + 2 * month + 3 * (month + 1) / 5 + year + year / 4 - year / 100 + year / 400) % 7 + 1; } }