datetime-如何在Windows Mobile上从C#中的文件获取修改日期?

我在PC中制作文件,并且想要将其传输到PPC(Windows Mobile)。

如何获得此文件的修改日期?

(我在Windows Mobile上需要它。)

Gold asked 2019-11-08T04:59:36Z
3个解决方案
85 votes

FileInfo.LastWriteTimeUtcFileInfo.LastWriteTimeUtc应该注册此信息。

Steve Guidi answered 2019-11-08T04:59:54Z
17 votes
string strFilePath = @"C:\myfile.txt";
DateTime lastModified = System.IO.File.GetLastWriteTime(strFilePath);

参考:MSDN上的File.GetLastWriteTime

vapcguy answered 2019-11-08T05:00:21Z
5 votes

尝试这个。

FileInfo fileInfo = new FileInfo("path");
var created = fileInfo.CreationTime; //File Creation
var lastmodified = fileInfo.LastWriteTime;//File Modification
raghu sathvara answered 2019-11-08T05:00:40Z
translate from https://stackoverflow.com:/questions/1185378/how-do-i-get-modified-date-from-file-in-c-sharp-on-windows-mobile