You must use regular expressions
If your dates always have the same format, you can easily write a regular expression that will extract dates from separate lines and cut something else on each side. To understand the regex, it should look like this:
\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}
, 0000-00-00 99:99:99, , , . , , , . ( ) ( , YYYY-MM-DD, YYYY-DD-MM):
[12]\d{3}-(?:0[1-9]|1[0-2])-(?:0[1-9]|[12]\d|3[01])\s(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)
1000 2999 01-12 01-31 00:00:00 23:59:59.
, , (date) , , , .
Regex rx = "(?<date>[12]\d{3}-(?:0\d|1[0-2])-(?:0[1-9]|[12]\d|3[01])\s(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)).*Test$";
if (rx.Text(line))
{
Match m = rx.Match(line);
// no need to use TryParse as regex assures correct formatting
fordDate = DateTime.Parse(m.Groups["date"]);
}
, , Test, .