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)

你可能感兴趣的:(ExtJS - Date Formats)