Question about date format conversion

Environment: springMVC+mybatis

Problem description: The time field type in the database is date, and when it is retrieved from the database, it becomes a String type. When the retrieved value is passed to the JSP page, there will be an extra .0, which will cause the date plugin to start in 1909. This is a problem. If it is to modify the page, it is not convenient for others to click to modify the time.



Solution:


First convert the extracted value into a date format, and then format the date in various formats

<fmt:parseDate value="${caseRecord.cjsj}" pattern="yyyy-MM-dd HH:mm:ss" var="myDate"/>
<input class="m-wrap span12" type="text" value=" <fmt:formatDate value='${myDate}' pattern='yyyy-MM-dd HH:mm:ss'/>"   style="width: 150px" id="cjsj"name="cjsj">


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325824421&siteId=291194637