Java Timestamp from convertStringToTimestamp(String str)

Here you can find the source of convertStringToTimestamp(String str)

Description

convert String To Timestamp

License

Apache License

Declaration

public static Timestamp convertStringToTimestamp(String str)
            throws Exception 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.sql.Timestamp;

public class Main {
    public static Timestamp convertStringToTimestamp(String str)
            throws Exception {
        //"2011-05-09 11:49:45";
        Timestamp ts = new Timestamp(System.currentTimeMillis());
        try {/*w  w  w .  j  a  va  2s.  com*/
            ts = Timestamp.valueOf(str);
        } catch (Exception ex) {
            throw new Exception(ex.getMessage() + str);
        }
        return ts;
    }
}

Related

  1. convertSQLTimestamp(String s, String formatIn, String formatOut)
  2. convertString2TimeStamp(String dateString)
  3. convertString2Timestamp(String value)
  4. convertStringDateToTimestamp(String sDate, String dateformat)
  5. convertStringToTimeStamp(String date)
  6. convertToTimestamp(Date aJavaDate)
  7. convertToTimestamp(java.util.Date date)
  8. convertToTimestamp(String dateData)
  9. convertToTimestamp(String dateString, String pattern)