title: How do I change the default local time format in C++?
body: <p>I have a function: </p>
  
  <pre><code>string get_current_time()
  {
      time_t rawtime;
      struct tm * timeinfo;
  
      time ( &amp;rawtime );
      timeinfo = localtime ( &amp;rawtime );
  
      return asctime (timeinfo);
  }
  </code></pre>
  
  <p>which returns time in the following format:</p>
  
  <pre><code>Fri Mar 18 11:25:04 2011
  </code></pre>
  
  <p>How do I change it so that it is returned in the following format?</p>
  
  <pre><code>2011 03-18 11-25-04 Fri
  </code></pre>
  
  <p>I want to use this for log file names.</p>