Here you can find the source of getDay(Date date)
public static int getDay(Date date)
//package com.java2s; /******************************************************************************* * Copyright (c) 2010 Oobium, Inc.// w w w . java 2 s . co m * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Jeremy Dowdall <jeremy@oobium.com> - initial API and implementation ******************************************************************************/ import java.util.Calendar; import java.util.Date; public class Main { public static int getDay() { return getField(new Date(), Calendar.DAY_OF_MONTH); } public static int getDay(Date date) { return getField(date, Calendar.DAY_OF_MONTH); } public static int getField(Date date, int field) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal.get(field); } public static int getField(int field) { return getField(new Date(), field); } }