Hi,
I have a txt file like this:
21/05/2020 17:05:00 ; info ; info ; info
I know how to get this part of the first column "21/05/2020 17:05:00" and put it as a variable.
Now I have the problem that I don't know how to compare this date and hour that is in my txt file with the date and the hour of windows.. and if it don't mach I need to get a message.
Can someone tell how the code should be?
Thank you.
This is what I'm trying at moment:
I saw that, in the debug mode, in the variable "date" he read "03/04/2019 11:22:09 --- \t "
Do someone know to fix this or how to implement it with what I need?
I have a txt file like this:
21/05/2020 17:05:00 ; info ; info ; info
I know how to get this part of the first column "21/05/2020 17:05:00" and put it as a variable.
Now I have the problem that I don't know how to compare this date and hour that is in my txt file with the date and the hour of windows.. and if it don't mach I need to get a message.
Can someone tell how the code should be?
Thank you.
This is what I'm trying at moment:
C#:
string[] liness = File.ReadAllLines(ofd.FileName);
if (liness.Length > 0)
{
string lastLine = liness[liness.Length - 1];
string[] columns = lastLine.Split(';');
if (columns.Length > 0)
{
string date = columns[0];
string dateString = date;
DateTime dateValue = DateTime.ParseExact(dateString, "dd/MM/yyyy HH:mm:ss", CultureInfo.CurrentCulture);
<-- but here it give me an error : ""String not recognized as a valid DateTime value."" I saw that, in the debug mode, in the variable "date" he read "03/04/2019 11:22:09 --- \t "
Do someone know to fix this or how to implement it with what I need?
Last edited by a moderator: