Requirement: Date data for seconds and minutes when the database is retained
Process: In MySQL, the date data type can only be stored in the date, so only the DateTime type, that in JDBC, call the Settimestamp () method, when the data is fetched, use the result set call Gettimstamp () method.
Issue: Although the Date object timestamp is removed, its ToString () method displays a data format that is YYYY-MM-DD hh:mm:ss.0, which is the millisecond value behind it and cannot be displayed directly on the page.
Workaround: The displayed string is processed on the display page. Use the JSTL tag
<%@ taglib uri= "http://java.sun.com/jsp/jstl/functions" prefix= "FN"%>
${fn:substring (item[' receive_date '],0,19)}
The string item[' receive_date '] is cut, the millisecond value is removed, and the desired string is obtained.
Settimestamp and MySQL datetime field issues