I have a JSP page, so the user can insert the time when he/she arrives and goes from the place manually.
My question is: how can I convert that String, from the input box (JSP) to then insert it to query thus into my MySQL table.
I am using Java – servlet.
Thanks
I have a JSP page, so the user can insert the time when he/she
Share
You can use
SimpleDateFormatto parse aStringin the given pattern to ajava.util.Dateobject.Assuming that it’s
HH:mm, then you can do so:Once having the
java.util.Dateobject, you can store it in aTIMEcolumn by converting it tojava.sql.Timeand usingPreparedStatement#setTime().