开发者

How to set start date and end date?

How to set Start Date and End Date using jQuer开发者_高级运维y Mobile?

For example, I selected one date (i.e start date) 24-5-2011 (May 24th,2011) then end date will be in less than or equal to 100 days from the start date.


Try this:

var start = new Date('5/24/2011');
var daysTillEnd = 100;
var isBetween = isBetween(start, daysTillEnd);

function isBetween(start,days){
    var startTS = start.getTime();
    var now = (new Date()).getTime();
    var endTS = startTS + days*24*60*60*1000;
    return now >= startTS && now <= endTS;    
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜