Date 比较ActionScript中的两个日期值-是否可以比较全天值?

Date 比较ActionScript中的两个日期值-是否可以比较全天值?,date,actionscript,comparison,Date,Actionscript,Comparison,我需要能够比较ActionScript中两个日期之间的天数,这可能吗 我想测试一个日期是否是今天之后的7天或更少,如果是,则是一天或更少(如果是今天之前,这也算在内) 我的解决方法是使用日期字段的.time部分: // Get the diffence between the current date and the due date var dateDiff:Date = new Date(); dateDiff.setTime (dueDate.time - currentDate.time

我需要能够比较ActionScript中两个日期之间的天数,这可能吗

我想测试一个日期是否是今天之后的7天或更少,如果是,则是一天或更少(如果是今天之前,这也算在内)

我的解决方法是使用日期字段的.time部分:

// Get the diffence between the current date and the due date
var dateDiff:Date = new Date();
dateDiff.setTime (dueDate.time - currentDate.time);
if (dateDiff.time < ( 1 * 24 * 60 * 60 * 1000 ))
    return "Date is within 1 day");
else if (dateDiff.time < ( 7 * 24 * 60 * 60 * 1000 ))
    return "Date is within 7 days");
//获取当前日期和到期日期之间的差异
var dateDiff:Date=新日期();
dateDiff.setTime(dueDate.time-currentDate.time);
如果(日期差时间<(1*24*60*60*1000))
返回“日期在1天内”);
否则如果(日期差时间<(7*24*60*60*1000))
返回“日期在7天内”);
正如我所说,这只是一个解决办法,我希望有一个永久的解决方案,让我检查两个日期之间的天数。这可能吗? 谢谢

var daysDifference:Number=Math.floor((dueDate.time currentDate.time)/(1000*60*60*24));
如果(日差<2)
返回“日期在1天之内”;
否则如果(日差<8)
返回“日期在7天内”;
此问题的副本:
var daysDifference:Number = Math.floor((dueDate.time-currentDate.time)/(1000*60*60*24));
if (daysDifference < 2)
   return "Date is within 1 day";
else if (daysDifference < 8)
   return "Date is within 7 days";