I have a system where the log file is generated with the current datetime at the beginning of each line.
eg.
LogUtil.Logger(DateTime.ToString("yyyy/MM/dd") + "|" + "My Message Here");
Depending on the culture this log file can result in a different separator between the year, month and day.
eg.
2015/11/19 or 2015.11.19
I am writing a separate utility which takes this resulting log file and parses it, sending other information to a 3rd party.
Since the date format is different, how can i get it to parse it correctly each time.
Currently im using:
DateTime.TryParseExact(line.Substring(0, 10), "yyyy/MM/dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out Date);
This format specifier only correctly formats 2015/11/19