Java SQL Date Get getDate(String date)

Here you can find the source of getDate(String date)

Description

Converts a string to date.

License

Open Source License

Parameter

Parameter Description
date the date string. May be null

Return

the converted date. May be null

Declaration

private static Date getDate(String date) 

Method Source Code


//package com.java2s;
/*/*from   w  ww .j av a  2s  . co m*/
 * Version: 1.0
 *
 * The contents of this file are subject to the OpenVPMS License Version
 * 1.0 (the 'License'); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.openvpms.org/license/
 *
 * Software distributed under the License is distributed on an 'AS IS' basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * Copyright 2014 (C) OpenVPMS Ltd. All Rights Reserved.
 */

import java.util.Date;

public class Main {
    /**
     * Converts a string to date.
     *
     * @param date the date string. May be {@code null}
     * @return the converted date. May be {@code null}
     */
    private static Date getDate(String date) {
        return date != null ? java.sql.Date.valueOf(date) : null;
    }
}

Related

  1. getDate(ResultSet rs, String colName)
  2. getDate(ResultSet rs, String column)
  3. getDate(ResultSet rs, String columnLabel)
  4. getDate(ResultSet rs, String columnName)
  5. getDate(String aDate, int dif)
  6. getDate(String date)
  7. getDate(String format)
  8. getDate(String pattern)
  9. getDate(String strDate)