使用<fmt>标签应先导入
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
其uri可在fmt.tld文件下
<fmt:formatDate value=“${XXX.date}” pattern=“yyyy-MM-dd HH:mm:ss”/> |
value:要格式化的日期
pattern:日期格式化的格式
<fmt:formatNumber value="12" type="currency" pattern="$.00"/> -- $12.00 |
java格式化输出:
DecimalFormat df = new DecimalFormat("格式"); String fmt =df.format(double); 符号 意义 0 一个数位 # 一个数位,前导零和追尾零不显示 . 小数点分割位置 , 组分隔符的位置 - 负数前缀 % 用100乘,并显示百分号 其他任何符号 在输出字符串中包括指定符号 |
JSTL fmt:formatNumber 对数据的日期、 数字、货币格式化
原文:http://blog.csdn.net/szms1/article/details/44594835