title: When using StopWatch and TimeSpan how can i get hours minutes and seconds without numbers after the point?
body: <p>I have two global vars:</p>
  
  <pre><code>private Stopwatch stopwatch = new Stopwatch();
  public static TimeSpan time = new TimeSpan();
  </code></pre>
  
  <p>Then i start the stopwatch in a button click and in another button click i stop it and doing:</p>
  
  <pre><code>stopwatch.Stop();
  time = stopwatch.Elapsed;
  </code></pre>
  
  <p>Then in form1:</p>
  
  <pre><code>return testclass.time;
  </code></pre>
  
  <p>The problem is in time i'm getting 00:00:00 format but for example in second i'm getting: 00:00:05.434455 i didn't check the minutes yet and hours but how can i make the format 00:00:00 that it will not have digits/numbers after the point in hours minutes and seconds ?</p>
  
  <p>So what i want to get in time is for example: 00:00:05 or 12:23:12 or 09:04:01
  Complete numbers without the digits after the point.</p>
  
  <p>This is the full code in a new class:</p>
  
  <pre><code>public static TimeSpan time = new TimeSpan();
   private Stopwatch stopwatch = new Stopwatch();
  
          private void videosInsertRequest_ResponseReceived(Video obj)
          {
              uploadstatus = obj.Status.UploadStatus;
              if (uploadstatus == "uploaded")
              {
                  stopwatch.Stop();
                  var milliseconds = stopwatch.ElapsedMilliseconds;
                  time = stopwatch.Elapsed;
                  uploadstatus = "file uploaded successfully";
              }
              if (uploadstatus == "Completed")
              {
  
              }
          }
  
          private void videosInsertRequest_ProgressChanged(IUploadProgress obj)
          {
              stringProgressReport[1] = obj.Status.ToString();
              if (stringProgressReport[1] == "Uploading")
              {
                  stopwatch.Start();
                  uploadstatus = "uploading file";
              }
          }
  </code></pre>
  
  <p>In the second event i start the StopWatch in the upper event i stop the StopWatch and assign to time the Elapsed property of the stopwatch.</p>
  
  <p>Then in form1:</p>
  
  <pre><code>public string SendResponse(HttpListenerRequest request)
          {
              string result = "";
              string key = request.QueryString.GetKey(0);
              if (key == "cmd")
              {
                  if (request.QueryString[0] == "uploadstatus")
                  {
                      switch (Youtube_Uploader.uploadstatus)
                      {
                          case "file uploaded successfully":
                              Youtube_Uploader.uploadstatus = "";
                              return "upload completed," + Youtube_Uploader.fileuploadpercentages + ","
                                 + test.time;
                     }
                 }
               }
           }
  </code></pre>
  
  <p>Then in form1 i return the time variable as part of a string.
  And then in other place in my program i'm using the time variable.</p>
  
  <p>The problem is as i described above with the result i'm getting in time.</p>
  
  <pre><code>if (textforspeech.contains("upload completed"))
                                  {
                                      String[] parts = textforspeech.split(",");
                                      String varr = parts[0];
                                      String varr1 = parts[1];
                                      String varr2 = parts[2];
  </code></pre>
  
  <p>In varr2 i'm getting the time "00:00:00"
  The problem is if it's not 00:00:00 but 00:00:05.54545
  I want to remove the digits after the point 54545 so i will get in varr2 only "00:00:05"</p>
  
  <p>Or of it's the hours then "12:04:05" or any other case but with complete numbers without the digits after the point.</p>