Here you can find the source of str2dateTime(String handedate)
Parameter | Description |
---|---|
handedate | a parameter |
public static Timestamp str2dateTime(String handedate)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.sql.Timestamp; public class Main { static public SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); /**/* w w w . jav a 2 s . com*/ * @param handedate * @return */ public static Timestamp str2dateTime(String handedate) { Timestamp time = null; try { java.util.Date date = str2utilDate(handedate); java.util.Date now = new java.util.Date(); date.setHours(now.getHours()); date.setMinutes(now.getMinutes()); date.setSeconds(now.getSeconds()); time = new Timestamp(date.getTime()); return time; } catch (Exception e) { System.out.println("DateUtil.str2dateTime(str) Error:e = " + e); return null; } } public static java.util.Date str2utilDate(String str) { try { java.util.Date udate = yyyyMMdd.parse(str); return udate; } catch (Exception e) { System.out.println("DateUtil.str2utilDate(str) Error:e = " + e); return null; } } }