title: Adding to a datetime
body: <p>Forgive me if it's already been asked here somewhere, but I couldn't find it, but here goes.</p>
  
  <p>In a log file I have, there's a time at which the values were logged and the time is written in <code>HH:mm:ss</code>.</p>
  
  <p>I need to parse multiple rows of that file, and so far the only way I can do that it adds a few minutes to the specific time I want to start parsing rows from.</p>
  
  <p>This is the code I currently use to add. However, when the Minute is something like "05" or anything below 10, it just removes the 0 and I end up having a time like this: 15:7:49 while it should be 15:07:49.</p>
  
  <p>When it DOES work and the time doesn't exist in the file, it adds another second. Sometimes the logtool skips a second, but never more than 1.</p>
  
  <pre><code>$a = [datetime]::ParseExact($a,"HH:mm:ss",$null)
  $time = [string]$a.Hour + ":" + ($a.Minute+5) + ":" + $a.Second
  if ($time -eq $time){$time = [string]$a.Hour + ":" + ($a.Minute+5) + ":" + $a.Second}
  else {$time = [string]$a.Hour + ":" + ($a.Minute+5) + ":" + ($a.Second+1)}
  </code></pre>
  
  <p>Basically, what I'm asking is, how can I add any number to the minute or second, without losing the <code>HH:mm:ss</code> format?</p>
  
  <p>Thanks.</p>