ExtJS - Date Formats

年:

  • Y: A full numeric representation of a year, 4 digits. Examples: 1999 or 2003
  • y: A two digit representation of a year

月:

  • m: Numeric representation of a month, with leading zeros. Examples: 01 to 12
  • n: Numeric representation of a month, without leading zeros
  • M: A short textual representation of a month. Examples: Jan to Dec

日:

  • d: Day of the month, 2 digits with leading zeros. Examples: 01 to 31
  • j: Day of the month without leading zeros.

示例:

Ext.Date.parse('2016/06/30', 'Y/m/d')
Thu Jun 30 2016 00:00:00 GMT+0800 (China Standard Time)

Ext.Date.parse('2016/6/30', 'Y/n/d')
Thu Jun 30 2016 00:00:00 GMT+0800 (China Standard Time)

Ext.Date.parse('2016/JUN/30', 'Y/M/d')
Thu Jun 30 2016 00:00:00 GMT+0800 (China Standard Time)

Ext.Date.parse('2016/6/1', 'Y/n/d')
undefined

Ext.Date.parse('2016/6/1', 'Y/n/j')
Wed Jun 01 2016 00:00:00 GMT+0800 (China Standard Time)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Date Date对象是JavaScript提供的日期和时间的操作接口 Date对象有几个静态方法 Date.no...
    南山码农阅读 962评论 0 0
  • SwiftDate概况 从Swift发布起,我们就没有放弃使用Swift。 当然,我们希望在项目能够轻松自如地管理...
    Mee_Leo阅读 10,341评论 1 13
  • 现在,好像每个人都有事可做,埋头做自己的事情。地铁上,公交车上,马路上,餐桌上…… 最近我一直在想,在没有智能手机...
    安小迈阅读 208评论 0 0
  • 天是白的,树是绿的,雨后的铁轨是重金属灰的,车是蓝的,墙是土黄的,核桃是油工的,歌是致自己的,自己是遍体鳞伤的,...
    YouOldman阅读 194评论 0 0
  • 函数的定义和调用 1.函数的定义 示例代码: 2.函数的调用 示例代码 函数的参数和返回值 1.无参函数 尽管这个...
    阿凡提说AI阅读 219评论 0 0

友情链接更多精彩内容