Home >Web Front-end >JS Tutorial >Use jstl tags in jsp pages to convert long timestamps

Use jstl tags in jsp pages to convert long timestamps

php是最好的语言
php是最好的语言Original
2018-08-01 14:03:422900browse

<strong>Code (reference)</strong>

##Backend:<strong></strong>

Use jstl tags in jsp pages to convert long timestamps

Page:

Use jstl tags in jsp pages to convert long timestamps

Use jstl tags in jsp pages to convert long timestamps

## is used in the jsp page The jstl tag converts the long timestamp into a formatted time string

1. Import the java.util.Date class through <span style="color:#f33b45;"></span><pre class="brush:js;toolbar:false;">&lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/fmt&quot; prefix=&quot;fmt&quot; %&gt;</pre>

2. Set the long time attribute value for the Date instance through <span style="color:#f33b45;"></span><pre class="brush:js;toolbar:false;">&lt;jsp:useBean id=&quot;dateValue&quot; class=&quot;java.util.Date&quot;/&gt; &lt;jsp:setProperty name=&quot;dateValue&quot; property=&quot;time&quot; value=&quot;${timestampValue}&quot;/&gt;</pre>

3. Format Date instance through <span style="color:#f33b45;"></span><pre class="brush:js;toolbar:false;">&lt;fmt:formatDate value=&quot;${dateValue}&quot; pattern=&quot;MM/dd/yyyy HH:mm&quot;/&gt;</pre>Related articles:

js and C# for time Stamp conversion_javascript skills


Conversion between java timestamp and PHP timestamp

Related videos:

jsp online reference manual

The above is the detailed content of Use jstl tags in jsp pages to convert long timestamps. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn