开发者

I want to know file creation date

开发者 https://www.devze.com 2023-04-07 16:15 出处:网络
I have a files list which contain the di开发者_开发百科rectory of file. I want to know file creation date of that files. I used fileInof.CreationTime. But It is not displayed creation date. How I can

I have a files list which contain the di开发者_开发百科rectory of file. I want to know file creation date of that files. I used fileInof.CreationTime. But It is not displayed creation date. How I can know about this.

'Get file info
Dim FileInfoVar As FileInfo = New FileInfo(Server.MapPath("~/Images/A.png"))

Dim DateVar as datetime = FileInfoVar.CreationTime

It didn't display real creation time. It displays like this 1/1/1611.


File.GetCreationTime gives you a DateTime object...which is of course a Date and a Time. Reading out the properties of the resulting object should give exactly what you need.

Edit: Looking at your editted question I seriously doubt that you are looking at the right file. Did you do a File.Exists first? The result you have now seems a bit weird.

0

精彩评论

暂无评论...
验证码 换一张
取 消