Java Timestamp Create getTimestamp(String dateStr)

Here you can find the source of getTimestamp(String dateStr)

Description

get Timestamp

License

Open Source License

Declaration

public static Timestamp getTimestamp(String dateStr) 

Method Source Code


//package com.java2s;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;

public class Main {
    public static Timestamp getTimestamp(String dateStr) {
        try {//w  w  w .  j ava  2  s.  co m
            SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy kk:mm:ss");
            Timestamp date = new Timestamp(dateFormat.parse(dateStr).getTime());
            return date;
        } catch (Exception ex) {
            System.out.println("Error: " + ex.toString());
            return null;
        }
    }
}

Related

  1. getTimestamp(Object value)
  2. getTimestamp(Object value, int columnType)
  3. getTimestamp(ResultSet rs, String colName)
  4. getTimestamp(ResultSet rs, String strColName)
  5. getTimestamp(String date, String time)
  6. getTimestamp(String dateString, String format)
  7. getTimestamp(String sqlDateTime)
  8. getTimestamp(String Str)
  9. getTimestamp(String str)