|
|||
|
Code:
import SWFKit.*;
f = new File("c:\\test.txt");
d = new Date(f.dateLastAccessed);
trace(f.dateLastAccessed);
trace(d.toLocaleString());
-347827083 Sun Dec 28 07:22:52 GMT+0800 1969 why the return value of dateLastAccessed was a negative number? |
|
|||
|
It will return a correct time value, unless the file does not exist. To check if the file has been modified within 24 hrs, you can
Code:
d = new Date(f.dateLastModified);
f = new File("c:\\test.txt")
var cur = new Date();
var modifiedWithin24hrs = (cur.getTime() - d) < 24*3600000;
trace(modifiedWithin24hrs);
|
|
|||
|
The file was modified in "Fri May 23 09:35:45 GMT+0800 2008"
I wrote my code: Code:
f = new File("c:\\test.txt");
d = new Date(f.dateLastModified);
trace("file: " + d.toLocaleString());
var cur = new Date();
trace("cur:" + cur.toLocaleString());
var modifiedWithin24hrs = (cur.getTime() - d) < 24*3600000;
trace("in 24 hr?" + modifiedWithin24hrs);
Code:
file: Mon Jan 5 02:29:27 GMT+0800 1970 cur:Fri May 23 09:46:40 GMT+0800 2008 in 24 hr?false |
![]() |
Was this information helpful? Yes No
| Thread Tools | |
| Display Modes | |
|
|