<fmt:formatdate value = "$ {isodate}" type = "blos"/>
2004-5-31 23:59:59
<fmt:formatdate value = "$ {date}" type = "date"/>
2004-4-1
<fmt:formatdate value = "$ {isodate}" type = "time"/>
23:59:59
<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日日
<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
<fmt:formatdate value = "$ {date}" type = "blos" pattern = "eeee、mmmm d、yyyy hh:mm:ss z"/>
星期四、四月1、2004 13:30:00 -0600
<fmt:formatdate value = "$ {isodate}" type = "blos" pattern = "d mmm yy、h:m:sa zzzz/>
31五月04、11:59:59
格式模式:
D月中的某一天。一位数的日期没有前导零。
DD月中的某一天。一位数的日期有一个前导零。
ddd周中某天的缩写名称、在ableviateddaynames中定义。
dddd周中某天的完整名称、在daynames中定义。
m月份数字。一位数的月份没有前导零。
mm月份数字。一位数的月份有一个前导零。
うーん、在ablvedmonthnames中定义。
うーん、在月の名前
y不包含纪元的年份。如果不包含纪元的年份小于10、则显示不具有前导零的年份。
yy不包含纪元的年份。如果不包含纪元的年份小于10、则显示具有前导零的年份。
yyyy包括纪元的四位数的年份。
gg时期或纪元。如果要设置格式的日期不具有关联的时期或纪元字符串、则忽略该模式。
H 12小时制的小时。一位数的小时数没有前导零。
HH 12小时制的小时。一位数的小时数有前导零。
H 24小时制的小时。一位数的小时数没有前导零。
HH 24小时制的小时。一位数的小时数有前导零。
m分钟。一位数的分钟数没有前导零。
mm分钟。一位数的分钟数有一个前导零。
s秒。一位数的秒数没有前导零。
SS秒。一位数的秒数有一个前导零。
<fmt:formatdate value = "$ {xx}" pattern = "dd/mm/yyyy hh:mm aa"/>和
<fmt:formatdate value = "$ {xx}" pattern = "dd/mm/yyyy hh:mm aa"/>>对于0点显示的结果不一样
要求$ {日付}为日付类型如果为文字列就用<td align = "center"> <script> document.write( "$ {l.inputdate}"。substring(0、10)); </script> < /td>
<%@ページ言語= "java" contentType = "text/html; charset = gb18030"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/fmt" prefix = "fmt"%>
<%@ taglib uri = "http://java.sun.com/jsp/jstl/core" prefix = "c"%>
<html>
<head>
<title>私のjsp 'fmt.jsp'開始ページ</title>
</head>
<body>
<c:var = "salary" value = "3540.2301"/>を設定します
<c:var = "合計"値= "56225.2301"/>を設定します
<fmt:setlocale value = "en_us"/>
通貨:<fmt:formatnumber value = "$ {salary}" type = "currency" currencycode = "usd"/> <br>
パーセント:<fmt:formatnumber value = "$ {salary/total}" type = "パーセント" maxfractiondigits = "4"/> <br>
<hr>
<jsp:usebean id = "now"> </jsp:usebean>
<fmt:setlocale value = "zh_cn"/>
full-> <fmt:formatdate value = "$ {now}" type = "both" datestyle = "full" timestyle = "full"/> <br>
long - > <fmt:formatdate value = "$ {now}" type = "both" datestyle = "long" timestyle = "long"/> <br>
medium-> <fmt:formatdate value = "$ {now}" type = "both" datestyle = "medium" timestyle = "medium"/> <br>
デフォルト - > <fmt:formatdate value = "$ {now}" type = "both" datestyle = "default" timestyle = "default"/> <br>
short-> <fmt:formatdate value = "$ {now}" type = "both" datestyle = "short" timestyle = "short"/> <br>
</body>
</html>
今天是:<fmt:formatdate value = "$ {now}" pattern = "g yyy年mm
现在是:<fmt:formatdate value = "$ {now}" pattern = "a hh:ss.s z"/>
结果:
今天是:公元2007年10月19℃
现在是:下午20:04:11.484 CST
<%@ 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">
入力パラメーターはパターンと一致する必要があります。または、JSPが例外をスローします。このページはエラー処理を行いません。
入力パラメーター:
日付:2004/04/01:13:30:00 Java形式:Thu Apr 01 13:30:00 CST 2004
Isodate:20040531T235959 Java Format:Mon 5月31日23:59:59 CDT 2004
日付
タグ出力
属性:値;必須。タグにはボディがありません。
<fmt:formatdate value = "$ {date}" type = "blos"/>
2004-4-1 13:30:00
<fmt:formatdate value = "$ {isodate}" type = "blos"/>
2004-5-31 23:59:59
属性:タイプ;オプション。印刷するものを示します:日付、時刻、またはその両方。
<fmt:formatdate value = "$ {date}" type = "date"/>
2004-4-1
<fmt:formatdate value = "$ {isodate}" type = "time"/>
23:59:59
属性:Datestyle;オプション。日付形式は変化します。
<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日日
属性:タイムスタイル。オプション。時間形式は変化します。
<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
属性:パターン;オプション。日付/時刻のカスタムパターンをindcatesします。
<fmt:formatdate value = "$ {date}" type = "blos" pattern = "eeee、mmmm d、yyyy hh:mm:ss z"/>
星期四、四月1、2004 13:30:00 -0600
<fmt:formatdate value = "$ {isodate}" type = "blos" pattern = "d mmm yy、h:m:sa zzzz/>
31五月04、11:59:59