-1

My first timespan is: "00:01:03,160"
and my second timespan is: "00:00:01,100"
i want to do an addition or subtraction between 00:01:03,160 to 00:00:01,100

00:01:03,160 + 00:00:01,100 = 00:01:04,260

i think that the format is : hh\:mm\:ss\,fff

SSID
  • 15
  • 2
  • 7

3 Answers3

1

You can use the TimeSpan.Add and TimeSpan.Subtract methods, such as:

ts1.Add(ts2);

or

ts1.Subtract(ts2);

Additionally, you're dealing with strings instead of TimeSpan objects-- if you need to convert these to TimeSpan objects, you can use TimeSpan.Parse. The full syntax that the Parse method understands is here:

http://msdn.microsoft.com/en-us/library/se73z7b9.aspx

Derek Kalweit
  • 921
  • 6
  • 6
0

Use the TimeSpan.Add method:

ts1.Add(ts2)

Source: http://msdn.microsoft.com/en-us/library/system.timespan.add.aspx#Y684

Forte L.
  • 2,772
  • 16
  • 25
0

How about this

Thread.CurrentThread.CurrentCulture = New CultureInfo("hr-HR")

TimeSpan.Parse("00:01:03,160").Add(TimeSpan.Parse("00:00:01,100").ToString()

The first line is unnecessary if your current culture supports that format of TimeSpan string representation.

Jodrell
  • 34,946
  • 5
  • 87
  • 124