drg wrote:
My assignment is actually encapsulation which is not the problem -- my
program needs to take two military times and calculate the minutes
elapsed between the two. I have everything worked out so far except how
to convert the military time from a string to an int. Or should I be
casting instead?
You should be using DateTime.Parse (or possibly DateTime.ParseExact) to
get the DateTime that reflects your first and second time, then just
subtract one from the other and you'll have your TimeSpan. The only
catch may be the handling of military time, but it should work.
example:
DateTime a = DateTime.Parse("10:59:44 PM");
DateTime b = DateTime.Parse("14:12:10");
TimeSpan c = b - a;
Chris.