title: How to format datetime to "yyyy-MM-dd"
body: <p>I want to convert date format to this <code>yyyy-MM-dd</code>. </p>
  
  <p>Below is my code:</p>
  
  <pre><code>var TimeOfOffer = priceCost.TimeOfOfferChange;
  DateTime ChangesOnTimeOfOfferChange = DateTime.ParseExact(TimeOfOffer, "dd-MM-yyyy HH:mm:ss", CultureInfo.InvariantCulture);
  priceCostViewmodel.TimeOfOfferChange = priceCost.TimeOfOfferChange;
  </code></pre>
  
  <p>But I am getting exception </p>
  
  <blockquote>
    <p>String was not recognized as a valid DateTime.</p>
  </blockquote>
  
  <p><code>priceCost.TimeOfOfferChange</code> is in string format i.e. "9/26/2016 4:38:58 PM"
  and wants to pass in string as well i.e. <code>priceCostViewmodel.TimeOfOfferChange</code></p>