Extjs4 获取到前一天的日期

Extjs4 获取到前一天的日期

Extjs官方示例

Ext.Date

( date, interval, value ) : Date

Provides a convenient method for performing basic date arithmetic. This method does not modify the Date instance being called - it creates and returns a new Date instance containing the resulting date value.

Examples:

// Basic usage:
var dt = Ext.Date.add(new Date('10/29/2006'), Ext.Date.DAY, 5);
console.log(dt); // returns 'Fri Nov 03 2006 00:00:00'

// Negative values will be subtracted:
var dt2 = Ext.Date.add(new Date('10/1/2006'), Ext.Date.DAY, -5);
console.log(dt2); // returns 'Tue Sep 26 2006 00:00:00'

 // Decimal values can be used:
var dt3 = Ext.Date.add(new Date('10/1/2006'), Ext.Date.DAY, 1.25);
console.log(dt3); // returns 'Mon Oct 02 2006 06:00:00'

//下面这是经过格式的获取前一天的日期

Ext.Date.format(Ext.Date.add(new Date(),Ext.Date.DAY,-1),'Y-m-d')

posted @ 2016-01-27 15:27  java渣渣  阅读(2317)  评论(0编辑  收藏  举报