Java Timestamp from convertToTimestamp(String s)

Here you can find the source of convertToTimestamp(String s)

Description

convert To Timestamp

License

Apache License

Declaration

public static Timestamp convertToTimestamp(String s) 

Method Source Code

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

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

public class Main {
    public static Timestamp convertToTimestamp(String s) {
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss.SSS");
        Timestamp timestamp = null;
        try {/*from  w ww .  j a v  a  2s . com*/
            timestamp = new Timestamp(dateFormat.parse(s).getTime());
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return timestamp;
    }
}

Related

  1. convertStringToTimestamp(String str)
  2. convertToTimestamp(Date aJavaDate)
  3. convertToTimestamp(java.util.Date date)
  4. convertToTimestamp(String dateData)
  5. convertToTimestamp(String dateString, String pattern)
  6. convertToTimeStamp(Timestamp timestamp, String format, TimeZone timeZone)
  7. convertToTimestampDate(Date date)
  8. convertToTimestampHMS(String dateData)
  9. getFirstTimeOfDay(Calendar calendar)