使用Ext获得一周内的时间

Ext.DateView source...singleton


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'

Available since: 4.0.0

Parameters

  • date : Date

    The date to modify

  • interval : String

    A valid date interval enum value.

  • value : Number

    The amount to add to the current date.

Returns

  • Date

    The new Date instance.




    例子:

    /**
    * 一周内的
    */
    function aa(){  
    var dt = new Date();
    var wd = Ext.Date.add(dt, Ext.Date.DAY, -7);
    var sd = Ext.Date.format(wd, 'Y-m-d H:i:s');
    var ed = Ext.Date.format(dt, 'Y-m-d H:i:s');
    alert(sd);
    alert(ed);
    return false;

    }




评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值