I am developing a simple web project. I want to store the date selected by the user with current time in the MySQL database. While trying to do that I am getting time as 00:00:00. What should I do to get the current time?
HERE IS MY CODE
String startdate = req.getParameter("date1");
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date parsedDate = dateFormat.parse(startdate);
Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
emp.store(timestamp); //method to store in database
In HTML page:
<input type="datetime" name="date1"/>