title: Newtonsoft JSON how to dynamically change the date format?
body: <p>I'm using Newtonsoft JSON Serializer and it's great and super fast but I'd like to do a bit more with it. I'm not sure it's possible as all the search I've done comes up to nothing. What I would like is to be able to truncate empty time, so when it's display <code>2014-01-01 00:00:00.000</code> I just want <code>2014-01-01</code> at the end, so basically cut the entire time when they're all zeros. For now I use this piece of code:</p>
  
  <pre><code>DataTable dt = loadData();
  
  // encode the string with Newton JSON.Net 
  string output = JsonConvert.SerializeObject(dt,
      new JsonSerializerSettings
      {
          ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
          Formatting = Newtonsoft.Json.Formatting.None,
          DateFormatString = "yyyy-MM-dd HH:mm:ss"
      });
  </code></pre>
  
  <p>Is there a way to format these dates without the time (only when they are all zeros) without affecting the performance?</p>