fmt:setTimeZone tag
fmt:setTimeZoneThe tag is used to copy a time zone object into a specified scope.
Syntax format
property
fmt:setTimeZoneThe tag has the following attributes:
| property | Description | Whether it is required | Default value |
|---|---|---|---|
| value | Timezone | Is | None |
| var | The name of the variable that stores the new time zone | No | Replace default |
| scope | The scope of the variable | No | Page |
Example Demonstration
<%@ 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" %>
JSTL fmt:setTimeZone 标签
当前时区时间:
修改为 GMT-8 时区:
Date in Changed Zone:
The running result is as follows:
当前时区时间: 2016年6月26日 上午11时34分05秒
Change to GMT-8 timezone:
Date in Changed Zone: 2016年6月25日 下午07时34分05秒
JSP Standard Tag Library