title: C# parse DateTime String to time only
body: <p>I am new to C# and I have a string like &quot;2021-06-14 19:27:14:979&quot;. Now I want to have only the time &quot;19:27:14:979&quot;. So do I parse the string to a specific DateTime format and then convert it back to a string or would you parse or cut the string itself?</p>
  <p>It is important that I keep the 24h format. I don't want AM or PM.</p>
  <p>I haven't found any solution yet. I tried to convert it to DateTime like:</p>
  <pre><code>var Time1 = DateTime.ParseExact(time, &quot;yyyy-MM-dd HH:mm:ss:fff&quot;); 
  var Time2 = Time1.ToString(&quot;hh:mm:ss:fff&quot;);
  </code></pre>
  <p>But then I lost the 24h format.</p>