I have a program that processes a text log file, retrieves the date time, converts the date time to the DateTime format of the system.
However, the program does not seem to recognize the selected time range. The program should retrieve records between the date and time selected by the user.
Is the problem probably related to code sequencing?
Can someone consult on codes? Thanks!
Codes:
String timeDate2 = result1.ToString("MM/dd/yyyy HH:mm:ss"); Console.WriteLine("The last written time to the registry was : " + timeDate2); TimeSpan.TryParse("12/02/2010 16:04:17", out t1); TimeSpan.TryParse("12/09/2010 05:12:42", out t2); TimeSpan.TryParse(timeDate2, out t3); if ((t3 >= t1 && t3 <= t2) == true) // Is t3 between t1 and t2? { foreach (String k in lines.Skip(12)) { Console.WriteLine(k); } x = 1; } else { x = 2; } Console.WriteLine("============================================================"); } if (x == 2) { Console.WriteLine("There is no selected days within the log files!"); }
source share