Latest web development tutorials

<Fmt: setTimeZone> tag

Biblioteca JSP Standard Tag Biblioteca JSP Standard Tag

<Fmt: setTimeZone> tag viene utilizzato per copiare un oggetto fuso orario per l'ambito specificato.

sintassi

<fmt:setTimeZone value="<string>" var="<string>" scope="<string>"/>

proprietà

<Fmt: setTimeZone> tag ha i seguenti attributi:

proprietà descrizione Se necessario difetto
valore Fuso orario è no
var Nome variabile per memorizzare il nuovo fuso orario no Sostituire predefinita
portata portata variabile no pagina


Esempi Demo

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<html>
<head>
<title>JSTL fmt:setTimeZone 标签</title>
</head>
<body>
<c:set var="now" value="<%=new java.util.Date()%>" />
<p>当前时区时间: <fmt:formatDate value="${now}" 
             type="both" timeStyle="long" dateStyle="long" /></p>
<p>修改为 GMT-8 时区:</p>
<fmt:setTimeZone value="GMT-8" />
<p>Date in Changed Zone: <fmt:formatDate value="${now}" 
             type="both" timeStyle="long" dateStyle="long" /></p>
</body>
</html>

I risultati sono i seguenti:

当前时区时间: 2016年6月26日 上午11时34分05秒

修改为 GMT-8 时区:

Date in Changed Zone: 2016年6月25日 下午07时34分05秒

Biblioteca JSP Standard Tag Biblioteca JSP Standard Tag