小白教程
所有教程
关于
Search
172.71.254.114
172.71.254.114
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Jstl format settimezone tag”的源代码
本页内容
上一节:
Jstl_format_timezone_tag
下一节:
Jstl_format_message_tag
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:<fmt:setTimeZone>}}[[Category:jsp jstl|23]] = <fmt:setTimeZone> 标签 = [[jsp jstl|JSP 标准标签库]] <fmt:setTimeZone>标签用来复制一个时区对象至指定的作用域。 === 语法格式 === <sample title="" desc="" lang="jsp" hererun="1"> <fmt:setTimeZone value="<string>" var="<string>" scope="<string>"/> </sample> === 属性 === <fmt:setTimeZone>标签有如下属性: {| class="table table-striped table-hover" ! '''属性''' ! '''描述''' ! '''是否必要''' ! '''默认值''' |- | value | 时区 | 是 | 无 |- | var | 存储新时区的变量名 | 否 | Replace default |- | scope | 变量的作用域 | 否 | Page |} == 实例演示 == <sample title="" desc="" lang="jsp" hererun="1"> <%@ 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> </sample> 运行结果如下: <sample title="" desc="" lang="jsp" hererun="1"> 当前时区时间: 2016年6月26日 上午11时34分05秒 修改为 GMT-8 时区: Date in Changed Zone: 2016年6月25日 下午07时34分05秒 </sample> [[jsp jstl|JSP 标准标签库]]
返回至“
Jstl format settimezone tag
”。
上一节:
Jstl_format_timezone_tag
下一节:
Jstl_format_message_tag