java - How to convert Date and Time to timeStamp -


how can convert date in mm/dd/yyyy format , time in hh:mm:ss timestamp can save in hsql database.

java.sql.timestamp has constructor takes long, first parse date string using simple date format time of date (long) , pass argument timestamp contructor.

date date = new simpledateformat("yyyy-mm-dd't'hh:mm:ss").parse(yourdatestring) long time = date.gettime(); timestamp timestamp = new timestamp(time); 

you following:

timestamp timestamp = timestamp.valueof("2014-08-18 8:19:15.0"); 

Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -