Hi,
I am using LastWriteTime property for a file which I use, to print the last modified time. However, here when I use I get a value like-
"3/13/2012 10:40:45 AM".
Can you tell me how to ignore seconds here meaning the output should be like: 3/13/2012 10:40 AM
Thanks
How to print only Date and Time (not seconds) in C#
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.


Gohil JayendrasinhRank #490 · 5K reputationPosted Mar 12, 2012, 9:39 PM EDT
string date = File.GetLastWriteTime("file").ToString("g");
if Asnwer is working for you then
Please check Accepted Asnwers
Arjun PanwarRank #254 · 9.9K reputationPosted Mar 13, 2012, 2:55 AM EDT