• <fmt:formatDate>标签的输出格式:


    <fmt:formatDate>标签的输出格式:
      d   月中的某一天。一位数的日期没有前导零。    
      dd   月中的某一天。一位数的日期有一个前导零。    
      ddd   周中某天的缩写名称,在   AbbreviatedDayNames   中定义。    
      dddd   周中某天的完整名称,在   DayNames   中定义。    
      M   月份数字。一位数的月份没有前导零。    
      MM   月份数字。一位数的月份有一个前导零。    
      MMM   月份的缩写名称,在   AbbreviatedMonthNames   中定义。    
      MMMM   月份的完整名称,在   MonthNames   中定义。    
      y   不包含纪元的年份。如果不包含纪元的年份小于   10,则显示不具有前导零的年份。    
      yy   不包含纪元的年份。如果不包含纪元的年份小于   10,则显示具有前导零的年份。    
      yyyy   包括纪元的四位数的年份。    
      gg   时期或纪元。如果要设置格式的日期不具有关联的时期或纪元字符串,则忽略该模式。    
      h   12   小时制的小时。一位数的小时数没有前导零。从1到12,分上下午 范围:01:00 AM~12:59AM    
      hh   12   小时制的小时。一位数的小时数有前导零。    
      H   24   小时制的小时。一位数的小时数没有前导零。从0到23,范围:00:00 AM~23:59AM    
      HH   24   小时制的小时。一位数的小时数有前导零。    
      m   分钟。一位数的分钟数没有前导零。    
      mm   分钟。一位数的分钟数有一个前导零。    
      s   秒。一位数的秒数没有前导零。    
      ss   秒。一位数的秒数有一个前导零。

      

    示例:index.jsp 

     

    显示结果:

    {type:both}  <fmt:formatDate value="<%=new Date() %>" type="both"/><!-- 2011-3-30 9:41:21 -->     
    <br/>     
    {type:date}  <fmt:formatDate value="<%=new Date() %>" type="date"/><!-- 2011-3-30 -->     
    <br/>     
    {type:time}  <fmt:formatDate value="<%=new Date() %>" type="time"/><!-- 9:44:44 -->     
    <br/>     
    {type:date, dateStyle:default}  <fmt:formatDate value="<%=new Date() %>" type="date" dateStyle="default"/><!-- 2011-3-30 -->     
    <br/>     
    {type:date, dateStyle:short}  <fmt:formatDate value="<%=new Date() %>" type="date" dateStyle="short"/><!-- 11-3-30  -->     
    <br/>     
    {type:date, dateStyle:medium}  <fmt:formatDate value="<%=new Date() %>" type="date" dateStyle="medium"/><!-- 2011-3-30 -->     
    <br/>     
    {type:date, dateStyle:long}  <fmt:formatDate value="<%=new Date() %>" type="date" dateStyle="long"/><!-- 2011年3月30日 -->     
    <br/>     
    {type:date, dateStyle:full}  <fmt:formatDate value="<%=new Date() %>" type="date" dateStyle="full"/><!-- 2011年3月30日 星期三 -->     
     <br/>     
    {type:time, timeStyle:default}  <fmt:formatDate value="<%=new Date() %>" type="time" timeStyle="default"/><!-- 10:01:32  -->     
    <br/>     
    {type:time, timeStyle:short}  <fmt:formatDate value="<%=new Date() %>" type="time" timeStyle="short"/><!-- 上午10:01  -->     
    <br/>     
    {type:time, timeStyle:medium}  <fmt:formatDate value="<%=new Date() %>" type="time" timeStyle="medium"/><!-- 10:01:32 -->     
    <br/>     
    {type:time, timeStyle:long}  <fmt:formatDate value="<%=new Date() %>" type="time" timeStyle="long"/><!-- 上午10时01分32秒 -->     
    <br/>     
    {type:time, timeStyle:full}  <fmt:formatDate value="<%=new Date() %>" type="time" timeStyle="full"/><!-- 上午10时01分32秒 CST  -->     
    <br/>     
    {type:both, pattern:EEEE, MMMM d, yyyy HH:mm:ss Z}  <fmt:formatDate value="<%=new Date() %>" type="both" pattern="EEEE, MMMM d, yyyy HH:mm:ss Z"/><!-- 星期三, 三月 30, 2011 10:01:32 +0800  -->     
    <br/>     
    {type:both, pattern:d MMM yy, h:m:s a zzzz}  <fmt:formatDate value="<%=new Date() %>" type="both" pattern="d MMM yy, h:m:s a zzzz"/><!-- 30 三月 11, 10:1:32 上午 中国标准时间 -->     
    <br/>     
    {pattern:dd/MM/yyyy HH:mm aa}}  <fmt:formatDate value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2011-3-30 13:12:12") %>" pattern="dd/MM/yyyy HH:mm aa"/><!-- 30/03/2011 13:12 下午 -->     
    <br/>     
    {pattern:dd/MM/yyyy hh:mm aa}  <fmt:formatDate value="<%=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse("2011-3-30 13:12:12") %>" pattern="dd/MM/yyyy hh:mm aa"/><!-- 30/03/2011 01:12 下午 -->    

    {type:both}  2011-3-30 10:07:42
    {type:date}  2011-3-30
    {type:time}  10:07:42
    {type:date, dateStyle:default}  2011-3-30
    {type:date, dateStyle:short}  11-3-30
    {type:date, dateStyle:medium}  2011-3-30
    {type:date, dateStyle:long}  2011年3月30日
    {type:date, dateStyle:full}  2011年3月30日 星期三
    {type:time, timeStyle:default}  10:07:42
    {type:time, timeStyle:short}  上午10:07
    {type:time, timeStyle:medium}  10:07:42
    {type:time, timeStyle:long}  上午10时07分42秒
    {type:time, timeStyle:full}  上午10时07分42秒 CST
    {type:both, pattern:EEEE, MMMM d, yyyy HH:mm:ss Z}  星期三, 三月 30, 2011 10:07:42 +0800
    {type:both, pattern:d MMM yy, h:m:s a zzzz}  30 三月 11, 10:7:42 上午 中国标准时间
    {pattern:dd/MM/yyyy HH:mm aa}  30/03/2011 13:12 下午
    {pattern:dd/MM/yyyy hh:mm aa}  30/03/2011 01:12 下午

  • 相关阅读:
    Linux常用命令
    C# 报表设计器 (winform 设计端)开发与实现生成网页的HTML报表
    完成复杂表头列表
    流程设计--页面介绍
    流程设计--设计理念
    报表设计--坐标实例-位移坐标
    Spring MVC 工作原理--自我理解
    java ==、equals和hashCode的区别和联系
    java 自动装箱和拆箱
    java maven笔记
  • 原文地址:https://www.cnblogs.com/car1900/p/5986560.html
Copyright © 2020-2023  润新知