GetLastWriteTime回到1600年12月31日下午7点00分00秒 [英] GetLastWriteTime returning 12/31/1600 7:00:00 PM

查看:146
本文介绍了GetLastWriteTime回到1600年12月31日下午7点00分00秒的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的code编写修改目录的时间标签的日期

I am using the following code to write the Date Modified time of a Directory to a label

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

它返回的日期1600年12月31号晚上7:00:00点,我不知道在那里获得自该日起。谁能帮助我理解为什么它返回的日期,我怎么能解决这个问题?我使用.NET 3.5

It returns the date 12/31/1600 7:00:00 PM which I have no clue where it is getting that date from. Can anyone help me understand why it is returning that date and how I can fix it? I'm using .NET 3.5

推荐答案

文档

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

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.

所以presumably时区为UTC-5(一月),以及目录不存在...

So presumably your time zone is UTC-5 (in January), and the directory doesn't exist...

这篇关于GetLastWriteTime回到1600年12月31日下午7点00分00秒的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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