0
I’m trying to calculate the difference between two dates and times, the format they appear in the file is:
day-month-year hour
Example
start time
17.11.17 22:55:12:968
end time
18.11.17 00:31:35:974
I’ve tried several things like:
DateTime dataUm = DateTime.Parse("17.11.17 19:06:35:625");
DateTime dataDois = DateTime.Parse("17.11.17 21:56:52:232");
TimeSpan ts = new TimeSpan(dataDois.Ticks-dataUm.Ticks);
But I always get mistakes:
Microsoft Visual Studio
Exception found. This may be caused by an extension.
I was going to close as not clear, but I think this solves, because the problem is just the culture or the mask.
– Maniero
Change the input values in the file to
"17.11.17 22:55:12:968"
and"18.11.17 00:31:35:974"
. I believe that milliseconds should be separated by"."
instead of":"
. If entry in this format is a requirement, you will have to do theparse
for Datetime specifying exactly the input format– Diego Rafael Souza
Good night this data is from a machine, I have to treat them the way they arrive.
– Jose Gonçalves