title: Outputting Date and Time in C++ using std::chrono
body: <p>I have been upgrading some old code and have been trying to update to c++11 where possible. The following code is how I used to display the time and date in my program</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  #include &lt;stdio.h&gt;
  #include &lt;time.h&gt;
  
  const std::string return_current_time_and_date() const
  {
      time_t now = time(0);
      struct tm tstruct;
      char buf[80];
      tstruct = *localtime(&amp;now);
      strftime(buf, sizeof(buf), "%Y-%m-%d %X", &amp;tstruct);
      return buf;
  }
  </code></pre>
  
  <p>I would like to output the current time and date in a similar format using std::chrono(or similar) but am unsure how to go about doing so. Any help would be greatly appreciated. Thanks</p>