K. Turek K. Turek - 1 month ago 4x
C# Question

Compare times repesented as string with colon

I have string with colon, for example

and I want to convert this to int variable. I was looking for solution in
but I don't find anything. I need that to compare two different times. Maybe is there any better way to do this?

var Str1 = "10:45";
var Str2 = "10:28";

if(TimeSpan.Parse(Str1) > TimeSpan.Parse(Str2) )