gpt4 book ai didi

c# - GetLastWriteTime 返回 12/31/1600 7 :00:00 PM

转载 作者:可可西里 更新时间:2023-11-01 07:50:10 26 4
gpt4 key购买 nike

我正在使用以下代码将目录的修改日期时间写入标签

string selectedPath = comboBox1.SelectedItem.ToString();
DateTime lastdate = Directory.GetLastWriteTime(selectedPath);
datemodified.Text = lastdate.ToString();

它返回日期 12/31/1600 7:00:00 PM,我不知道它是从哪里得到那个日期的。任何人都可以帮助我理解为什么它返回那个日期以及我如何解决它?我正在使用 .NET 3.5

最佳答案

来自 the documentation :

If the directory 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.

所以大概您的时区是 UTC-5(一月),并且该目录不存在...

关于c# - GetLastWriteTime 返回 12/31/1600 7 :00:00 PM,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10583938/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com