Java Timestamp Parse parseTimestamp(String sDate, String sFormat)

Here you can find the source of parseTimestamp(String sDate, String sFormat)

Description

parse Timestamp

License

Open Source License

Declaration

public static Timestamp parseTimestamp(String sDate, String sFormat) throws ParseException 

Method Source Code


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

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

public class Main {

    public static Timestamp parseTimestamp(String sDate, String sFormat) throws ParseException {
        java.text.SimpleDateFormat formatter = null;

        java.util.Date utildate = null;
        formatter = new java.text.SimpleDateFormat(sFormat);
        utildate = formatter.parse(sDate);
        java.sql.Timestamp tsdate = new java.sql.Timestamp(utildate.getTime());
        return tsdate;
    }/*from www .j a  v  a  2  s .  com*/
}

Related

  1. parseTimestamp(String dateStr, String format)
  2. parseTimestamp(String dateString)
  3. parseTimestamp(String pattern, String dateTime)
  4. parseTimestamp(String s)
  5. parseTimestamp(String s)
  6. parseTimestamp(String src, String pattern)
  7. parseTimestamp(String strDate)
  8. parseTimestamp(String time)
  9. parseTimestamp(String timestamp)