我看了GetLastWriteTime函数的msdn, 看看人家的提示 Note Not all file systems use the same semantics to implement the time stamp returned by this function. This function may return the same value returned by other time stamp functions if the underlying file system or server does not support keeping the time attribute. See theWin32_Find_Data structure for information about time formats. On some operation systems, the returned time is in the time zone local to the machine were the file is located. See the Win32FileTimeToLocalFileTime API for more information.建议你用FileTimeToLocalFileTime函数将时间转换一下,试试
Note Not all file systems use the same semantics to implement the time stamp returned by this function. This function may return the same value returned by other time stamp functions if the underlying file system or server does not support keeping the time attribute. See theWin32_Find_Data structure for information about time formats. On some operation systems, the returned time is in the time zone local to the machine were the file is located. See the Win32FileTimeToLocalFileTime API for more information.建议你用FileTimeToLocalFileTime函数将时间转换一下,试试
{
用ftpFind.GetLastWriteTime取得此文件的最后修改时间和实际相差1年。
}比如FTP服务器上一文件a.txt的时间是 2004-11-30 10:00(用cutftp看到)
如果我本地机器的时间在2004-11-30 18:00之前的话,我取到的时间都是2003-11-30 10:00(相差一年)我还发现用ie去看此文件信息存在相同的情况,我怀疑是微软的BUG。我想应该是有办法解决的,因为用cutftp取到的时间总是正确的,不知道他是怎么取的,有谁知道吗?
因为许多FTP服务器的实现是:如果该文件的年份是当前的年份,他下发的时候是不会传年份的。服务服务器是IIS的FTP服务器,把格式设为ms_dos格式就OK了。