获取VB.NET文件的修改日期 [英] Get file modified date in VB.NET

查看:1592
本文介绍了获取VB.NET文件的修改日期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有许多文件夹中的文件,我需要得到的最后修改日期。所以我用

I have a number of files in a folder, and I need to get the last modified date. So I used

FDate = IO.File.GetLastWriteTime(FName)

它正常工作与一些文件,但其他人,我得到了1601年1月1日的日期。但是,当我检查在Windows资源管理器中的文件,所有日期看起来正常(近期的)。所以,我猜有存储在文件系统中的多个文件的日期,和那些.NET是看到的不是那些Windows正在看到的。我怎样才能得到完全的修改日期在文件资源管理器窗口出现的日期吗?

It works fine with some files, but on others, I get a date of 1/1/1601. But when I check the files in Windows Explorer, all the dates look normal (recent). So, I'm guessing there are multiple files dates stored in the file system, and the ones .NET is seeing are not the ones Windows is seeing. How can I get exactly the date which appears as "date modified" in a file explorer window?

我尝试了一些的Visual Basic 6.0 API的东西,但这并不似乎在.NET中工作。

I tried some Visual Basic 6.0 API stuff, but that doesn't seem to work in .NET.

推荐答案

从<一个href="http://msdn.microsoft.com/en-us/library/system.io.file.getlastwritetime.aspx">File.GetLastWriteTime方法:

如果路径参数所描述的文件不存在,午夜12:00这个方法返回,1月1日,公元1601(CE)协调世界时(UTC),调整为本地时间。

If the file described in the path parameter does not exist, this method returns 12:00 midnight, January 1, 1601 A.D. (C.E.) Coordinated Universal Time (UTC), adjusted to local time.

您所查询的文件可能丢失。

The file you are querying is probably missing.

这篇关于获取VB.NET文件的修改日期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆