var FSO = new ActiveXObject("Scripting.FileSystemObject");
var BFolder = "C:\\temp";
var XFolder = FSO.GetFolder(BFolder+"\\");
var FList = new Enumerator(XFolder.Files);
var today = new Date();
for (; !FList.atEnd(); FList.moveNext()) {
var d = FList.item().DateLastModified;
if (d.getMonth() == today.getMonth) { // <----- *
}
else {
}
}
如何使上述比较(*)有效?
答案 0 :(得分:2)
您应该使用today.getMonth()
代替today.getMonth
也许替换
var d = FList.item().DateLastModified;
通过
var d = new Date(FList.item().DateLastModified);
答案 1 :(得分:0)
假设d
是Date
个对象,您可以这样比较几个月:
if (d.getMonth() == today.getMonth()) { …
(您需要致电 Date.getMonth
)。