2009-11-02 58 views

回答

4

像這樣的東西可能:

var then = new Date("11/2/2009").getTime(), 
    now = new Date().getTime(), 
    thirtyDaysInMilliseconds = 2592000000; 
if (now - then > thirtyDaysInMilliseconds) { doSomething(); } 
1

你必須確保你的約會符合格式(MM-DD-YYYY),但這應該工作:

var olddate = "11/02/2009" 
var dt = Date.parse(olddate); 
return ((Date.getTime() - dt.getTime()) < 2592000000); 
相關問題