Java SQL Time From getDateTime(ResultSet rs, String field, Calendar cal)

Here you can find the source of getDateTime(ResultSet rs, String field, Calendar cal)

Description

get Date Time

License

Open Source License

Declaration

@SuppressWarnings("deprecation")
    public static Date getDateTime(ResultSet rs, String field, Calendar cal) throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.ResultSet;
import java.sql.SQLException;

import java.util.Calendar;
import java.util.Date;

public class Main {
    @SuppressWarnings("deprecation")
    public static Date getDateTime(ResultSet rs, String field, Calendar cal) throws SQLException {

        Date date = rs.getDate(field, cal);
        Date time = rs.getTime(field, cal);
        if (date == null || time == null) {
            return null;
        } else {/*w  ww  .j ava  2s .c om*/
            cal.clear();
            cal.set(1900 + date.getYear(), date.getMonth(), date.getDate(), time.getHours(), time.getMinutes(),
                    time.getSeconds());
            return cal.getTime();
        }
    }
}

Related

  1. getDateTime(String dateTime)
  2. getDateTime(String s)
  3. getDatetime(String value)
  4. getDateTimeBySecond(long timeMillis)