JSTL日期格式化用法
JSP Standard Tag Libraries
Formatting and Internationalization
Two form input parameters, 'date' and 'isoDate', are URL-encoded in the link leading to this page. 'isoDate' is formatted according to the ISO8601 standard.
Formatting of numbers and dates is based on the browser's locale setting. Formatting will change if you switch the default language setting from English to French or German, for example. (The browser needs to be restarted, too.)
Library import and parameter capturing:
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
<fmt:parseDate value="${param.date}" var="date" pattern="yyyy/MM/dd:HH:mm:ss>
<fmt:parseDate value="${param.isoDate}" var="isoDate" pattern="yyyyMMdd'T'HHmmss">
The input parameters must match the patterns, or the JSP will thrown an exception. This page does no error handling.
Input parameters:
Date: 2004/04/01:13:30:00 Java format: Thu Apr 01 13:30:00 CST 2004
isoDate: 20040531T235959 Java format: Mon May 31 23:59:59 CDT 2004
Dates
Tag Output
Attribute: value; required. Tag has no body.
<fmt:formatDate value="${date}" type="both"/>
2004-4-1 13:30:00
<fmt:formatDate value="${isoDate}" type="both"/>
2004-5-31 23:59:59
Attribute: type; optional. Indicates what to print: date, time, or both.
<fmt:formatDate value="${date}" type="date"/>
2004-4-1
<fmt:formatDate value="${isoDate}" type="time"/>
23:59:59
Attribute: dateStyle; optional. Varies the date format.
<fmt:formatDate value="${isoDate}" type="date" dateStyle="default"/>
2004-5-31
<fmt:formatDate value="${isoDate}" type="date" dateStyle="short"/>
04-5-31
<fmt:formatDate value="${isoDate}" type="date" dateStyle="medium"/>
2004-5-31
<fmt:formatDate value="${isoDate}" type="date" dateStyle="long"/>
2004年5月31日
<fmt:formatDate value="${isoDate}" type="date" dateStyle="full"/>
2004年5月31日 星期一
Attribute: timeStyle; optional. Varies the time format.
<fmt:formatDate value="${isoDate}" type="time" timeStyle="default"/>
23:59:59
<fmt:formatDate value="${isoDate}" type="time" timeStyle="short"/>
下午11:59
<fmt:formatDate value="${isoDate}" type="time" timeStyle="medium"/>
23:59:59
<fmt:formatDate value="${isoDate}" type="time" timeStyle="long"/>
下午11时59分59秒
<fmt:formatDate value="${isoDate}" type="time" timeStyle="full"/>
下午11时59分59秒 CDT
Attribute: pattern; optional. Inidcates date/time custom patterns.
<fmt:formatDate value="${date}" type="both" pattern="EEEE, MMMM d, yyyy HH:mm:ss Z"/>
星期四, 四月 1, 2004 13:30:00 -0600
<fmt:formatDate value="${isoDate}" type="both" pattern="d MMM yy, h:m:s a zzzz/>
JSTL日期格式化用法的更多相关文章
- Freemarker 内置函数 数字、字符串、日期格式化用法介绍
在用FreeMarker过程中,感觉FreeMarker的字符串,日期,集合等处理能力还是很强大的,上网搜了一些资料,整理如下,以便能帮助大家更熟练的应用Freemarker完成项目开发. 一.Seq ...
- Asp.net中具体的日期格式化用法
1.绑定时格式化日期方法: <ASP:BOUNDCOLUMN DATAFIELD= "JoinTime " DATAFORMATSTRING= "{0:yyyy-M ...
- JSP中利用JSTL标签对日期格式化
数据库:Mysql 开发语言:JAVA 页面类型:JSP 对Mysql中的日期类型格式化,在JSP中,如何办呢,很多人说在JAVA后台去日期格式化,无奈了,于是找到了比较靠谱的答案 需要先引入JSTL ...
- SQLServer日期格式化
0 或 100 (*) 默认值 mon dd yyyy hh:miAM(或 PM) 1 101 美国 mm/dd/yyyy ...
- sql日期格式化
0 或 100 (*) 默认值 mon dd yyyy hh:miAM(或 PM) 1 101 美国 mm/dd/yyyy ...
- [转]sql server 数据库日期格式化函数
转至:http://www.cnblogs.com/hantianwei/archive/2009/12/03/1616148.html 0 或 100 (*) 默认值 mon ...
- [置顶] fmt日期格式化
jstl中的日期格式化 <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> & ...
- 日期格式化标签<fmt:formatDate>&<fmt:setTimeZone>时区标签的使用demo
日期格式化标签<fmt:formatDate>&<fmt:setTimeZone>时区标签的使用demo <%@ page contentType="t ...
- Java日期格式化方法
首先获取当前系统时间的方法有两种:第一种可以用currentTimeMillis()方法获取,它其实产生的是一个当前的毫秒数,这个毫秒是自1970年1月1日0时起至现在的毫秒数,类型是long 型,可 ...
随机推荐
- Weighted-Residual-Connections
- 如何使 pdf 文件在浏览器里面直接下载而不是打开
前言 在做需求过程中我们大概率会遇到在浏览器中下载文件的需求,如果仅仅是这个要求的话很简单,有如下两种解决方式. 第一种是通过 window 对象的 open 方法进行操作,将文件 url 直接在浏览 ...
- 01 树莓派4B—C语言编程——GPIO
#include <stdio.h>#include <wiringPi.h> int main( void){ int LED1 = 1; int LED4 = 4; wir ...
- java实现一个简单的爬虫小程序
前言 前些天无意间在百度搜索了一下以前写过的博客 我啥时候在这么多不知名的网站上发表博客了???点进去一看, 内容一模一样,作者却不是我... 然后又去搜了其他篇博客,果然,基本上每篇都在别的网站上有 ...
- 思维导图概览SpringCloud
@ 目录 1.什么是微服务 1.1.架构演进 1.2.微服务架构 1.3.微服务解决方案 2.SpringCloud概览 2.1.什么是SpringCloud 2.1.SpringCloud主要组件 ...
- 后端程序员必备的 Linux 基础知识+常见命令(近万字总结)
大家好!我是 Guide 哥,Java 后端开发.一个会一点前端,喜欢烹饪的自由少年. 今天这篇文章中简单介绍一下一个 Java 程序员必知的 Linux 的一些概念以及常见命令. 如果文章有任何需要 ...
- Promise.then返回的是什么?
console.log((function cook(){ console.log('开始做饭.'); var p = new Promise(function(resolve, reject){ / ...
- FCIS:Fully Convolutional Instance-aware Semantic Segmentation
论文:Fully Convolutional Instance-aware Semantic Segmentation 目录 0.简介 1.Position-sensitive Score Map ...
- Mysql多条数据以一条展示和判断某字符是否在某字段
多条数据以一条数据展示:GROUP_CONCAT select GROUP_CONCAT(uuid) from user; 判断某字符是否存在某字段:INSTR select * from( sele ...
- firewall几个常用命令
systemctl status firewalld firewall-cmd --zone=public --add-port=80/tcp --permanent firewall-cmd --r ...