获取文件创建时间

实现效果:

  

知识运用:

  FileInfo类的CreationTime属性   //获取或设置当前FileInfo对象的创建时间

  public DataTime CreationTime   { get;set }

实现代码:

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog P_openFileDialog = new OpenFileDialog();
            if (P_openFileDialog.ShowDialog() == DialogResult.OK)
            {
                FileInfo f = new FileInfo(P_openFileDialog.FileName);
                MessageBox.Show("文件创建日:"+
                    f.CreationTime.ToString(),"提示");
            }
        }

 补充:

  FileInfo类的LastWriteTime属性   // 获取文件的最后修改时间

原文地址:https://www.cnblogs.com/feiyucha/p/10216188.html