//Convert from String type to Timestamp type
//Receive values from form and combine
String delivery = form.getDeliveryDate() + " " + form.getDeliveryTime();
//format Description for conversion
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh");
java.util.Date parsedDate = null;
try {
parsedDate = dateFormat.parse(delivery);
} catch (ParseException e) {
e.printStackTrace();
}
Timestamp timestamp = new java.sql.Timestamp(parsedDate.getTime());
I will leave it as a memorandum. If there is any other good way, please teach me!
Recommended Posts