Java SQL Date Create convertStringToSql(final String dateStr)

Here you can find the source of convertStringToSql(final String dateStr)

Description

convert String To Sql

License

Open Source License

Declaration

public static Timestamp convertStringToSql(final String dateStr) throws ParseException 

Method Source Code


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

import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;

public class Main {
    static SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

    public static Timestamp convertStringToSql(final String dateStr) throws ParseException {
        return new Timestamp(format.parse(dateStr).getTime());
    }//from  w w  w  . j a  v  a2s  .  c o  m
}

Related

  1. convertSqlDate(java.util.Date date)
  2. convertSqlDate2Calendar(java.sql.Date date)
  3. convertSqlDateToJavaDate(java.sql.Date sqlDate)
  4. convertSQLDateToUtilDate(java.sql.Date date)
  5. convertSqlUtil(java.util.Date d)
  6. convertToCalendar(Date date)
  7. convertToDatabaseDate(Date date)
  8. convertToDate(Object o)
  9. convertToMySqlDate(Date date)