1
我需要能夠比較ActionScript中兩個日期之間的整個天數,這可能嗎?在動作腳本中比較兩個日期值 - 可以比較全天值?
我想測試一個日期是否在今天之後7天或更短,如果是這樣,它是一天或更少(如果是在今天之前,這也是重要的)。
的解決方法我在的地方使用日期字段的。時間部分:
// 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");
正如我所說的 - 這只是一種變通方法,我想一個永久性的解決方案,讓我檢查兩個日期之間的整個天數。這可能嗎? 感謝
這個問題的
重複:HTTP://stackoverflow.com/questions/7268770/as2-calculate-days-between-two-dates/726906 – divillysausages