How do I do division on HH:MM:SS format time strings in C#?
Posted
by
Jake
on Stack Overflow
See other posts from Stack Overflow
or by Jake
Published on 2011-01-11T21:48:16Z
Indexed on
2011/01/12
0:54 UTC
Read the original article
Hit count: 173
I have a series of times that are coming to me as strings from a web service. The times are formated as HH:MM:SS:000 (3 milisecond digits). I need to compare two times to determine if one is more than twice as long as the other:
if ( timeA / timeB > 2 )
What's the simplest way to work with the time strings?
If I was writing in Python this would be the answer to my question: Difference between two time intervals in Python
Edit: What I'm really looking for is a way to get the ratio of timeA to timeB, which requires division, not subtraction. Unfortunately, the DateTime structure doesn't appear to have a division operator. Updated the question title to reflect this.
© Stack Overflow or respective owner