Click here to Skip to main content
15,921,837 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<pre lang="c#">private void textBox1_TextChanged(object sender, EventArgs e)
        {
            DateTime.LastModified = System.IO.File.GetLastWriteTime(@"C:\sinsdn38.ap.infineon.com\ArchView\03_Reports");

            Console.WriteLine(LastModified.ToString("dd/mm/yy HH:mm:ss")); 
        }


Hi. I have an issue of "LastModified" does not exsit in current context. How do I go about defining lastmodified?

Thank you!

What I have tried:

Changing the name of the textbox?
Posted
Updated 12-Feb-18 19:40pm

1 solution

Hello,
As per my knowledge ,DateTime has no such property(LastModified).
To get last modified date of a file you can try below code.
DateTime lastModified = System.IO.File.GetLastWriteTime(@"C:\abcd.txt");
Console.WriteLine(lastModified.ToString("dd/MM/yy HH:mm:ss"));

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900