小白教程
所有教程
关于
Search
172.70.100.144
172.70.100.144
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Jstl format parsedate tag”的源代码
本页内容
上一节:
Jstl_format_formatdate_tag
下一节:
Jstl_format_bundle_tag
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:<fmt:parseDate>}}[[Category:jsp jstl|18]] = <fmt:parseDate> 标签 = [[jsp jstl|JSP 标准标签库]] <fmt:parseDate> 标签用于解析日期。 === 语法格式 === <sample title="" desc="" lang="jsp" hererun="1"> <fmt:parseDate value="<string>" type="<string>" dateStyle="<string>" timeStyle="<string>" pattern="<string>" timeZone="<string>" parseLocale="<string>" var="<string>" scope="<string>"/> </sample> === 属性 === <fmt:parseDate>标签有如下属性: {| class="table table-striped table-hover" ! 属性 ! 描述 ! 是否必要 ! 默认值 |- | value | 要显示的日期 | 是 | 无 |- | type | DATE, TIME, 或 BOTH | 否 | date |- | dateStyle | FULL, LONG, MEDIUM, SHORT, 或 DEFAULT | 否 | default |- | timeStyle | FULL, LONG, MEDIUM, SHORT, 或 DEFAULT | 否 | default |- | pattern | 自定义格式模式 | 否 | 无 |- | timeZone | 显示日期的时区 | 否 | 默认时区 |- | var | 存储格式化日期的变量名 | 否 | 显示在页面 |- | scope | 存储格式化日志变量的范围 | 否 | 页面 |} 属性设置我们需要的输出的时间格式。 == 实例演示 == <sample title="" desc="" lang="jsp" hererun="1"> <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %> <html> <head> <title>JSTL fmt:parseDate 标签</title> </head> <body> <h3>日期解析:</h3> <c:set var="now" value="20-10-2015" /> <fmt:parseDate value="${now}" var="parsedEmpDate" pattern="dd-MM-yyyy" /> <p>解析后的日期为: <c:out value="${parsedEmpDate}" /></p> </body> </html> </sample> 以上实例运行结果: <sample title="" desc="" lang="jsp" hererun="1"> 日期解析: 解析后的日期为: Tue Oct 20 00:00:00 CST 2015 </sample> [[jsp jstl|JSP 标准标签库]]
返回至“
Jstl format parsedate tag
”。
上一节:
Jstl_format_formatdate_tag
下一节:
Jstl_format_bundle_tag