title: C# Newtonsoft.Json cannot parse date
body: <p>I am using <a href="https://www.nuget.org/packages/newtonsoft.json/" rel="nofollow noreferrer">Newtonsoft.Json</a> in my project for json parsing from server.</p>
  
  <pre><code>public class MyObj
  {
      public DateTimeOffset TimeStamp { get; set; }
      //other fields....
  }
  </code></pre>
  
  <p>Then:</p>
  
  <pre><code>MyObj test = JsonConvert.DeserializeObject&lt;MyObj&gt;(jObject.ToString());
  </code></pre>
  
  <p>Test:</p>
  
  <pre><code>"TimeStamp": "2018-05-26T04:59:40:888Z" //Could not convert string to DateTimeOffset
  "TimeStamp": "2018-05-26T04:59:40:88Z"  //Could not convert string to DateTimeOffset
  "TimeStamp": "2018-05-26T14:59:40:888Z" //Could not convert string to DateTimeOffset
  "TimeStamp": "2018-05-26T14:59:40:88Z"  //Could not convert string to DateTimeOffset
  
  "TimeStamp": "2018-05-26T03:29:46.777Z" //works
  "TimeStamp": "2018-05-26T13:29:46.77Z"  //works
  "TimeStamp": "2018-05-26T03:29:46.777Z" //works
  "TimeStamp": "2018-05-26T13:29:46.77Z"  //works
  </code></pre>
  
  <p>Error:</p>
  
  <blockquote>
    <p>Newtonsoft.Json.JsonReaderException: Could not convert string to DateTimeOffset: 2018-05-27T04:59:40:887Z.</p>
  </blockquote>
  
  <p>I am not sure why this happens, because the date is from server. </p>
  
  <p>Edit:</p>
  
  <pre><code>{
    "clientTimestamp": "2018-05-27T06:08:40:688Z",
    "modifiedType": "",
    "type": "TEXT",
    "messageSize": 5,
    "roomId": "689355a0-604b-11e8-ae6a-9d170520ec46",
    "messageContent": "hello"
  }
  </code></pre>
  
  <p>Update I finally found the issue. It was not the server response that I was parsing. It was my own object that I parsed. The description:</p>
  
  <pre><code>public class TempClass
  {
      public DateTime TimeStamp { get; set; }
  }
  </code></pre>
  
  <p>Does not work</p>
  
  <pre><code>JObject jObject = new JObject();
  jObject.Add("TimeStamp", DateTime.Now.ToString("yyyy-MM-ddTHH:mm:ss:fffZ"));
  TempClass chatMessage = JsonConvert.DeserializeObject&lt;TempClass&gt;(jObject.ToString());
  </code></pre>
  
  <p>Works</p>
  
  <pre><code>JObject jObject = new JObject();
  jObject.Add("TimeStamp", DateTime.Now);
  TempClass chatMessage = JsonConvert.DeserializeObject&lt;TempClass&gt;(jObject.ToString());
  </code></pre>