I'm trying to get the difference of 2 dates in min or seconds. When I check the dates, they are both correct with the correct time. When I try to get the difference of the 2, it's not correct. Am I doing this wrong?
Dim strFileInfo As New System.IO.FileInfo("C:\testfile.txt") 'get file info
Dim dateDiff As TimeSpan = DateTime.Now.Subtract(strFileInfo.LastWriteTime.Date)
MsgBox(strFileInfo.LastWriteTime.TimeOfDay.ToString & " " & Date.Now.TimeOfDay.ToString & " " & dateDiff.Seconds.ToString)
If dateDiff.Seconds >= 120 Then 'if older than 2 min, dont use it. info is not current