title: Order by date and convert to string In list
body: <p>I have the following code:</p>
  
  <pre><code>List&lt;EncryptionReport&gt; result = null;
  result = m_encryptionSvc.GetReportsFromRefnr(tuples);
  
  result = result
    .OrderByDecending(e =&gt; e.Acc_date)
    .ThenBy(e =&gt; e.Acc_date.ToString("YYYY-mm-dd H:mm:ss"))
    .ToList();
  </code></pre>
  
  <p>The thing I want to Is sort by date in descending order and then parse the dates to string-format. But the parsing don't work.</p>
  
  <p>How can I parse the dates to string after the sorting?</p>
  
  <p><strong>Solution</strong></p>
  
  <pre><code>      var test = result.OrderBy(e =&gt; e.Acc_date)
                      .Select(x =&gt; 
                          new 
                          { 
                              x.Accident_nr,
                              x.Encrypted,
                              x.ExistsInStrada,
                              x.Id,
                              x.Original,
                              x.Report_id,
                              x.ReportSource,
                              x.State,
                              @Acc_date = x.Acc_date.ToString("yyyy-MM-dd hh:mm:ss")
                          })
                      .ToList();
  </code></pre>