Here you can find the source of getDateTwo(Date date)
public static Date getDateTwo(Date date)
//package com.java2s; /******************************************************************************* * Copyright (c) 2005, 2006 IBM Corporation and others. 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 * /*from ww w.j av a 2s .c om*/ * Contributors: IBM Corporation - initial API and implementation *******************************************************************************/ import java.util.Calendar; import java.util.Date; public class Main { public static Date getDateTwo(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); int day = calendar.get(Calendar.DATE); calendar.set(Calendar.DATE, day); return getSqlDate(calendar.getTime()); } public static java.sql.Date getSqlDate(Date date) { if (null == date) return null; return new java.sql.Date(date.getTime()); } }