Wednesday, March 28, 2012

subtracting 2 times in string format

Hi,

I have 2 strings in "HH:mm" format, for example "03:55" or "22:09"

Is there any easy to way subtract 2 strings in this format ??

such that if string1 ="22:10"

and string2 = "01:30"

then answer should be string1 - string2

"20:40"

Thanks,

Split the strings into arrays, then do the math on the arrays.

string[] astrMySTring = DateString.Split(":");

then cast them as integers.

however, you might want to use the Date functions to do date Calculations... base 60 is a pain... crazy Babylonians.

0 comments:

Post a Comment