Java SQL Date Get getDateTwo(Date date)

Here you can find the source of getDateTwo(Date date)

Description

get Date Two

License

Open Source License

Declaration

public static Date getDateTwo(Date date) 

Method Source Code

//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());
    }
}

Related

  1. getDateOrTime(int colType, Object o)
  2. getDateParameter(java.sql.Date date, int param)
  3. getDatePath(java.sql.Timestamp fileDate)
  4. getDatePath(java.util.Date fileDate)
  5. getDateStart(Date date)
  6. getDateValue(ResultSet result, String strField, String strDateFormat)
  7. getDateValue(ResultSet result, String strField, String strDateFormat)
  8. getDateWithSpecifiedHourAndMinute(Date targetDate, int hour, int minute)
  9. getDateYYMM(java.sql.Timestamp ts)