Here you can find the source of stringToTimesTamp(String yMd, boolean isEndTime)
public static Timestamp stringToTimesTamp(String yMd, boolean isEndTime)
//package com.java2s; //License from project: Open Source License import java.sql.*; public class Main { public static Timestamp stringToTimesTamp(String yMd, boolean isEndTime) { if (yMd == null || yMd.length() == 0) { return null; }// w w w .j a v a 2 s. co m Timestamp ts = new Timestamp(System.currentTimeMillis()); StringBuffer buf = new StringBuffer(); buf.append(yMd); if (isEndTime) { buf.append(" 23:59:59"); } else { buf.append(" 00:00:00"); } try { ts = Timestamp.valueOf(buf.toString()); } catch (Exception e) { e.printStackTrace(); } return ts; } }