Here you can find the source of stringToSqlDate(String dateVal)
Parameter | Description |
---|---|
dateVal | - string date value |
Parameter | Description |
---|---|
Exception | an exception |
public static java.sql.Date stringToSqlDate(String dateVal) throws Exception
//package com.java2s; public class Main { /**/*w w w . j a va 2s . c o m*/ * This method is used to convert the date String in the format of * "yyyy-MM-dd" to Sql Date * * @param dateVal - * string date value * @return sqlDate * @throws Exception */ public static java.sql.Date stringToSqlDate(String dateVal) throws Exception { if (dateVal != null && !"".equals(dateVal)) { java.sql.Date sqlDate = java.sql.Date.valueOf(dateVal); return sqlDate; } else { return null; } } }