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是最好的语言
Release: 2018-08-01 14:03:42
Original
2877 people have browsed it

<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><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false;">&lt;%@ taglib uri=&quot;http://java.sun.com/jsp/jstl/fmt&quot; prefix=&quot;fmt&quot; %&gt;</pre><div class="contentsignin">Copy after login</div></div>

2. Set the long time attribute value for the Date instance through <span style="color:#f33b45;"></span><div class="code" style="position:relative; padding:0px; margin:0px;"><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><div class="contentsignin">Copy after login</div></div>

3. Format Date instance through <span style="color:#f33b45;"></span><div class="code" style="position:relative; padding:0px; margin:0px;"><pre class="brush:js;toolbar:false;">&lt;fmt:formatDate value=&quot;${dateValue}&quot; pattern=&quot;MM/dd/yyyy HH:mm&quot;/&gt;</pre><div class="contentsignin">Copy after login</div></div>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!

Related labels:
jsp
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template