在页面显示当前系统日期及其格式化

 在jsp页面显示系统的当前日期及其时间,在xml文档中的格式不同其在页面上的格式化的格式将也要有所区别,否则将无法显示或者达不到想要的效果!!!以下举例说明:

    在xml中定义格式: 格式1.<genDate><fmt:formatDate pattern="yyyy-MM-dd" value="${vipCardList.genDate}"/></genDate>

                                    格式2.<genDate>${fn:substring(vipCardList.genDate,0,16)}</genDate>

 而在js中显示时则要用对应的格式才能正确的读取日期,

即:格式1.{id:'genDate', xtype:"datefield", fieldLabel:"创建时间", name:"textvalue",readOnly:true ,format:'Y-m-d'}

 格式2.{id:'genDate', xtype:"datefield", fieldLabel:"创建时间", name:"textvalue",format:'Y-m-d h:m',readOnly:true} 

 

另外在添加数据时,日期的初始化形式应为(此为ajax编写的js页面代码):

格式1:{id:'genDate', xtype:"datefield", fieldLabel:"创建时间", name:"textvalue",format:'Y-m-d,readOnly:true, value:new Date() }或者{id:'genDate', xtype:"datefield", fieldLabel:"创建时间", name:"textvalue",readOnly:true } 

格式2{id:'genDate', xtype:"datefield", fieldLabel:"创建时间", name:"textvalue",format:'Y-m-d h:m',readOnly:true, value:new Date() }

 

两者的区别是:格式1读取的日期精确到天,显示的时间格式为:YYYY-MM-DD;而格式2读取的日期精确到分,显示的时间格式为:YYYY-MM-DD HH:MM 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值