I have a program which processes a log text file, retrieves the date time, converts the date time to the system's DateTime format.
However the program does not seem to recognized the various date time range that is selected. The program should retrieve the records between the date and time selected by the user.
The problem would probably be due to the sequencing of the codes?
May someone please advise on the codes? Thanks!
The 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!");
}