Try this:
string input = "140:43";
string[] parts = input.Split(':');
int hours = int.Parse(parts[0]);
int minutes = int.Parse(parts[1]);
int seconds;
if (parts.Length < 3)
{
seconds = 0;
}
else
{
seconds = int.Parse(parts[2]);
}
TimeSpan TS = new TimeSpan(hours, minutes, seconds);
TimeSpan resultAfterDivision = new TimeSpan(TS.Ticks / 30);
First, you need to split the given string. The first part is the number of hours and the second part the number of minutes. If no third part is given, the number of seconds is 0. Otherwise, the number of seconds is the third part of the input.
Then, to divide the
TimeSpan
, you need to divide its number of ticks.