Java Timestamp strToTimestamp(String dateStr)

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

Description

str To Timestamp

License

Apache License

Declaration

public static Timestamp strToTimestamp(String dateStr) 

Method Source Code


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

import java.sql.Timestamp;

import java.text.SimpleDateFormat;

import java.util.Date;

public class Main {
    public static final SimpleDateFormat formatTimestamp = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static Timestamp strToTimestamp(String dateStr) {
        return Timestamp.valueOf(dateStr);
    }/* www  .j  ava 2  s . c o m*/

    public static Timestamp strToTimestamp(Date date) {
        return Timestamp.valueOf(formatTimestamp.format(date));
    }
}

Related

  1. sqlDateToCalendar(Timestamp date)
  2. SQLTimestampToDate(java.sql.Timestamp ts)
  3. sqlTimestampToDate(Timestamp t)
  4. StrToDateTimeFormat(String timestampStr,String pattern)
  5. strToTimestamp(String date)
  6. strToTimestamp(String i_Today, String i_Hour, String i_Minute)
  7. StrToTimestamp(String timestampStr,String pattern)
  8. timestamp()
  9. timestamp(int year, int month, int day, int hour, int minute, int second, int nanosecond)