Java SQL Time Create getTime(ResultSet resultSet, String columnName)

Here you can find the source of getTime(ResultSet resultSet, String columnName)

Description

Returns a time value using a given SQL result set and column name.

License

Open Source License

Parameter

Parameter Description
resultSet - Result set.
columnName - Column name.

Return

Time - Column value.

Declaration

public static Date getTime(ResultSet resultSet, String columnName) throws SQLException 

Method Source Code

//package com.java2s;
/*//ww  w  .  j  a  v a2  s  .  co  m
 * Copyright (C) 2015 Bryan W. Snipes
 * 
 * This file is part of the JDistil web application framework.
 * 
 * JDistil is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * JDistil is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with JDistil.  If not, see <http://www.gnu.org/licenses/>.
 */

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

import java.util.Date;

public class Main {
    /**
      Returns a time value using a given SQL result set and column name.
      @param resultSet - Result set.
      @param columnName - Column name.
      @return Time - Column value.
    */
    public static Date getTime(ResultSet resultSet, String columnName) throws SQLException {

        // Initialize return value
        Date value = null;

        if (resultSet != null && columnName != null) {
            value = resultSet.getTime(columnName);
        }

        return value;
    }
}

Related

  1. getTime(long time)
  2. getTime(long time, boolean allowNull)
  3. getTime(Map map, String attr)
  4. getTime(Object value)
  5. getTime(Object value, int columnType)
  6. getTime(ResultSet rs, String column)
  7. getTime(String time)
  8. getTimeAndDateStamp(String line)
  9. getTimeBy(int hour)