Here you can find the source of getToday()
public static Date getToday()
//package com.java2s; /******************************************************************************* * Copyright (c) 2008 Ralf Ebert/* w ww. j a v a 2 s. c om*/ * 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: * Ralf Ebert - initial API and implementation *******************************************************************************/ import java.util.Calendar; import java.util.Date; public class Main { /** * Returns the date representing today (by system time) without time * * @return */ public static Date getToday() { Calendar c = Calendar.getInstance(); setZeroTime(c); return c.getTime(); } /** * Sets hour, minute, second, millisecond set to 0 for the given Calendar * object * * @param c * Calendar object */ private static void setZeroTime(Calendar c) { c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); } }