如何获取文件夹创建日期在C# [英] How to get only Folder Creation Date in C#

查看:439
本文介绍了如何获取文件夹创建日期在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道,例如: DateTime fileCreatedDate = File.GetCreationTime(@C:\Example\MyTest.txt); 将返回日期和时间的文件夹创建,但如何只得到Date示例2014-12-01Decemeber 12,2014的文件夹创建不包括时间?

I know that, Example: DateTime fileCreatedDate = File.GetCreationTime(@"C:\Example\MyTest.txt");will return the date and time of a folder creation but how do I only get the "Date"Example "2014-12-01" or "Decemeber 12,2014" of the folder creation excluding the time?

推荐答案

您可以使用 DateTime.Date 属性,即 fileCreatedDate.Date

这篇关于如何获取文件夹创建日期在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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