Java Timestamp Parse parseTimestamp(String src, String pattern)

Here you can find the source of parseTimestamp(String src, String pattern)

Description

parse Timestamp

License

LGPL

Declaration

public static Timestamp parseTimestamp(String src, String pattern) throws ParseException 

Method Source Code

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

import java.sql.Timestamp;

import java.text.ParseException;
import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {

    public static Timestamp parseTimestamp(String src, String pattern) throws ParseException {
        Date date = parseDate(src, pattern);
        return new Timestamp(date.getTime());
    }//  w  w w.ja v  a2 s .  co  m

    public static Date parseDate(String src, String pattern) throws ParseException {
        return getSDFormat(pattern).parse(src);

    }

    private static SimpleDateFormat getSDFormat(String pattern) {
        return new SimpleDateFormat(pattern);
    }
}

Related

  1. parseTimestamp(String dateString)
  2. parseTimestamp(String pattern, String dateTime)
  3. parseTimestamp(String s)
  4. parseTimestamp(String s)
  5. parseTimestamp(String sDate, String sFormat)
  6. parseTimestamp(String strDate)
  7. parseTimestamp(String time)
  8. parseTimestamp(String timestamp)
  9. parseTimeStamp(String timeStamp)