title: How to check if a string in yyyyMMddHHmmss format in C#?
body: <p>I want to check if a string is in <code>yyyyMMddHHmmss</code> format in C#. What is the best way to do it.</p>
  
  <p>Here I have tried with <code>DateTime.TryParse</code>, but it always return <code>false</code>.</p>
  
  <pre><code>string currentFileName = "Test_File_20190312122838";
  string timestampValue = currentFileName.Substring(currentFileName.LastIndexOf('_')+ 1);
  DateTime outDate = DateTime.Now;
  
  if (DateTime.TryParse(timestampValue, out outDate)) // always return false
  {
  }
  </code></pre>
  
  <p>Note: Sometimes <code>timestampValue</code> may contain normal text instead of a timestamp value.</p>