Java SQL Time Parse string2Time(String dateString)

Here you can find the source of string2Time(String dateString)

Description

string Time

License

Apache License

Declaration

public final static java.sql.Timestamp string2Time(String dateString) throws java.text.ParseException 

Method Source Code

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

import java.text.DateFormat;

import java.text.SimpleDateFormat;

import java.util.Locale;

public class Main {
    public final static java.sql.Timestamp string2Time(String dateString) throws java.text.ParseException {
        DateFormat dateFormat;//  w  ww . ja v a 2s.co m
        dateFormat = new SimpleDateFormat("yyyy-MM-dd kk:mm:ss", Locale.ENGLISH);
        dateFormat.setLenient(false);
        java.util.Date timeDate = dateFormat.parse(dateString);
        java.sql.Timestamp dateTime = new java.sql.Timestamp(timeDate.getTime());

        return dateTime;
    }
}

Related

  1. parseDateTime(String original, int type)
  2. parseTime(String s)
  3. parseTime(String str)
  4. parseTime(String timeString)
  5. printTime(Time time, String format)
  6. string2Time(String time, DateFormat timeFormat)
  7. stringToTime(String data, String dateFormat)
  8. stringToTime(String schedule)
  9. stringToTime(String sTime)