title: DateTime.ToString() format that can be used in a filename or extension?
body: <p>I want to add a timestamp to filenames as files are created but most of the DateTime methods I've tried output something with spaces and slashes. For instance:</p>
  
  <pre><code>Debug.WriteLine(DateTime.Now.ToString()); // &lt;-- 9/19/2012 1:41:46 PM
  Debug.WriteLine(DateTime.Now.ToShortTimeString()); // &lt;-- 1:41 PM
  Debug.WriteLine(DateTime.Now.ToShortDateString()); // &lt;-- 9/19/2012
  Debug.WriteLine(DateTime.Now.ToFileTime()); // &lt;-- 129925501061462806
  </code></pre>
  
  <p><code>ToFileTime()</code> works but is not exactly human-readable. How can I format the output to a human-readable timestamp with date and time that can be used in a filename or extension? Prefereably something like <code>2011-19-9--13-45-30</code>?</p>