As we all know, the time in the database is of the Date type, and the yyyy-mm-dd format is usually displayed on the page, and, JSONObject is often used to transmit time objects from JSP pages to front-end controllers and backend services. JSONObject only supports the String type. Therefore, the storage and retrieval of time objects involve converting Date to String. Suppose our requirement is to get a system time and save it to the Database Table time, And then retrieve it and display it on the page. Then, after the Controller receives the input time from the JSP page, it must convert the time to the String type so that it can be added to the JSONObject and delivered to the background. Yes: Date date = new Date (); DateFormat dateFormat = new impleDateFormat ("yyyy-MM-dd"); String addTime = dateFormat. format (date); time. put ("addTime", addTime) is retrieved from the database and displayed on the page. How can this problem be solved? Similarly, the Controller obtains the result set of the time set through the background service and converts it to the String type to be uploaded to the JSP page for display. DateFormat dateFormat = new impleDateFormat ("yyyy-MM-dd"); String addTime = dateFormat. format (time. getAddTime (); now let's think about how to query this table if the time is used as a column and there are other fields in the table. We get the set of objects through the service. If the table name is courseMappingVO, The courseMappingVOList is returned and uploaded as the result set to the JSP page. How can I display the time properly? Even if the time is not a column in the table, but a unique column in the table, it is not easy to convert in the Controller (of course not difficult to convert) and then transmitted to the JSP page for display. What's more, it is a column in a table, so we have to think about whether the conversion can be performed on the JSP page, so we will not be worried about how to pass the results. The answer is yes: Similarly, the courseMappingVoList is uploaded as the result to the JSP page. The code for displaying the result on the JSP page is as follows: in this way, the time is normally displayed in the format of yyyy-mm-dd. The author's test page is as follows: